@font-face { font-family: 'Plex Sans'; font-weight: 400; font-display: swap; src: url(fonts/ibm-plex-sans-latin-400.woff2) format('woff2'); unicode-range: U+0000-00FF, U+2000-206F, U+20AC, U+2122, U+2190-21FF; }
@font-face { font-family: 'Plex Sans'; font-weight: 400; font-display: swap; src: url(fonts/ibm-plex-sans-cyrillic-400.woff2) format('woff2'); unicode-range: U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: 'Plex Sans'; font-weight: 500; font-display: swap; src: url(fonts/ibm-plex-sans-latin-500.woff2) format('woff2'); unicode-range: U+0000-00FF, U+2000-206F, U+20AC, U+2122, U+2190-21FF; }
@font-face { font-family: 'Plex Sans'; font-weight: 500; font-display: swap; src: url(fonts/ibm-plex-sans-cyrillic-500.woff2) format('woff2'); unicode-range: U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: 'Plex Mono'; font-weight: 400; font-display: swap; src: url(fonts/ibm-plex-mono-latin-400.woff2) format('woff2'); unicode-range: U+0000-00FF, U+2000-206F, U+2190-21FF; }
@font-face { font-family: 'Plex Mono'; font-weight: 400; font-display: swap; src: url(fonts/ibm-plex-mono-cyrillic-400.woff2) format('woff2'); unicode-range: U+0400-045F; }
@font-face { font-family: 'Plex Mono'; font-weight: 500; font-display: swap; src: url(fonts/ibm-plex-mono-latin-500.woff2) format('woff2'); unicode-range: U+0000-00FF, U+2000-206F, U+2190-21FF; }

:root {
  --bg-deep: #0f0f10; --bg: #141415; --card: #19191b; --raised: #232325;
  --line: rgba(237, 237, 237, .08); --line-strong: rgba(237, 237, 237, .14);
  --text: #ededed; --text-2: #a1a1a6; --muted: #85858b;
  --accent: #46c37b; --accent-ink: #0c1f14; --neg: #e5484d;
  --sans: 'Plex Sans', system-ui, sans-serif; --mono: 'Plex Mono', ui-monospace, monospace;
  --ease: cubic-bezier(.22, 1, .36, 1);
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 400 14px/20px var(--sans); -webkit-font-smoothing: antialiased; }
[hidden] { display: none !important; }
a { color: var(--text); text-underline-offset: 3px; text-decoration-color: var(--line-strong); }
a:hover { text-decoration-color: var(--text-2); }
.mono, code, pre { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.sec { color: var(--text-2); }
h1, h2, h3 { font-weight: 500; margin: 0; }
h1 { font-size: 28px; line-height: 1.15; }
h2 { font-size: 16px; line-height: 24px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* controls */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 36px; padding: 0 16px; border-radius: 8px; border: 1px solid var(--line-strong);
  background: var(--raised); color: var(--text); font: 500 14px/1 var(--sans); cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: background-color .15s var(--ease), border-color .15s var(--ease), transform .12s var(--ease); }
.btn:hover { background: #2b2b2e; }
.btn:active { transform: scale(.98); }
.btn.primary { background: var(--text); color: #141415; border-color: transparent; box-shadow: inset 0 1px 0 rgba(255,255,255,.4); }
.btn.primary:hover { background: #ffffff; }
.btn.quiet { background: transparent; border-color: transparent; color: var(--text-2); }
.btn.quiet:hover { background: var(--raised); color: var(--text); }
.btn.danger { color: #ff8a8d; }
.btn.small { height: 28px; padding: 0 10px; font-size: 13px; border-radius: 6px; }
.btn[disabled] { opacity: .45; cursor: not-allowed; transform: none; }
.icon { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; flex: none; }
input[type=text], input[type=number], input[type=url], input[type=password], input[type=date], select, textarea {
  height: 36px; padding: 0 12px; border-radius: 8px; border: 1px solid var(--line-strong); background: var(--bg-deep); color: var(--text);
  font: 400 14px/1 var(--sans); width: 100%; transition: border-color .15s var(--ease); }
textarea { height: auto; min-height: 96px; padding: 10px 12px; line-height: 20px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--text-2); }
input.mono { font-family: var(--mono); }
.field { display: grid; gap: 8px; color: var(--text-2); font-size: 13px; }
.seg { display: inline-flex; padding: 2px; gap: 2px; background: var(--bg-deep); border: 1px solid var(--line); border-radius: 8px; }
.seg button { height: 28px; padding: 0 12px; border: 0; border-radius: 6px; background: transparent; color: var(--text-2); font: 400 13px/1 var(--sans); cursor: pointer; transition: background-color .15s var(--ease), color .15s var(--ease); }
.seg button:hover { color: var(--text); }
.seg button[aria-pressed=true] { background: var(--raised); color: var(--text); box-shadow: inset 0 1px 0 rgba(255,255,255,.08); }

/* shell */
.shell { display: grid; grid-template-columns: 248px minmax(0, 1fr); min-height: 100vh; }
.side { background: var(--bg-deep); border-right: 1px solid var(--line); padding: 20px 12px; display: flex; flex-direction: column; gap: 24px; position: sticky; top: 0; height: 100vh; }
.brand { display: flex; align-items: center; gap: 10px; padding: 0 8px; font-size: 16px; font-weight: 500; height: 28px; }
.brand .mark { width: 24px; height: 24px; }
.brand small { font-size: 12px; color: var(--muted); font-weight: 400; font-family: var(--mono); }
.nav { display: grid; gap: 2px; }
.nav a { display: flex; align-items: center; gap: 10px; height: 34px; padding: 0 8px; border-radius: 8px; color: var(--text-2); text-decoration: none; transition: background-color .15s var(--ease), color .15s var(--ease); }
.nav a:hover { color: var(--text); background: rgba(237,237,237,.04); }
.nav a[aria-current=page] { color: var(--text); background: var(--raised); box-shadow: inset 0 1px 0 rgba(255,255,255,.06); }
.side-foot { margin-top: auto; display: grid; gap: 12px; padding: 0 8px; }
.balance-label { font-size: 13px; color: var(--muted); }
.balance { font: 500 24px/1 var(--mono); font-variant-numeric: tabular-nums; }
.who { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding-top: 12px; border-top: 1px solid var(--line); font-size: 13px; color: var(--text-2); }
.who span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
main { padding: 32px; max-width: 1280px; width: 100%; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 24px; min-height: 36px; }
.page-head p { margin: 8px 0 0; color: var(--text-2); }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; }
.notice { padding: 12px 16px; border-radius: 10px; border: 1px solid rgba(229,72,77,.35); background: rgba(229,72,77,.08); color: #ffb3b5; margin-bottom: 24px; }

/* models list */
.models { list-style: none; margin: 0; padding: 0; }
.model { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 16px; padding: 16px 20px; border-top: 1px solid var(--line); }
.model:first-child { border-top: 0; }
.model-name { font-size: 15px; font-weight: 500; }
.model-meta { margin-top: 4px; color: var(--text-2); font-family: var(--mono); font-size: 13px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.model-meta .sep { color: var(--muted); opacity: .6; }
.dot { width: 6px; height: 6px; border-radius: 50%; background: var(--muted); opacity: .5; display: inline-block; }
.dot.live { background: var(--accent); opacity: 1; }
.chip { display: inline-flex; align-items: center; gap: 8px; height: 28px; padding: 0 6px 0 10px; border-radius: 6px; background: var(--bg-deep); border: 1px solid var(--line); font: 400 12px/1 var(--mono); color: var(--text-2); }
.copy { border: 0; background: transparent; color: var(--muted); width: 22px; height: 22px; border-radius: 4px; display: inline-grid; place-items: center; cursor: pointer; transition: color .15s var(--ease), background-color .15s var(--ease); }
.copy:hover { color: var(--text); background: var(--raised); }
.empty { padding: 48px 20px; text-align: center; color: var(--text-2); }

/* key */
.key-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.panel { padding: 20px 24px; display: grid; gap: 16px; }
.kv { display: grid; gap: 8px; }
.kv .label { font-size: 13px; color: var(--muted); }
.kv .value { display: flex; align-items: center; gap: 8px; font-family: var(--mono); font-size: 14px; }
.secret { padding: 12px 12px 12px 16px; border-radius: 10px; background: var(--bg-deep); border: 1px solid rgba(70,195,123,.4); display: flex; align-items: center; gap: 12px; font-family: var(--mono); word-break: break-all; }
pre.code { margin: 0; padding: 16px 20px; border-radius: 10px; background: var(--bg-deep); border: 1px solid var(--line); font-size: 12.5px; line-height: 20px; color: var(--text-2); overflow-x: auto; white-space: pre; }
pre.code .k { color: var(--text); }
pre.code .s { color: var(--accent); }

/* stats */
.stat-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin-bottom: 16px; }
.stat { padding: 16px 20px; }
.stat-row-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.stat-sub { margin-top: 8px; font-size: 12px; }
.stat .label { font-size: 13px; color: var(--text-2); }
.stat .figure { margin-top: 12px; font: 500 28px/1 var(--mono); font-variant-numeric: tabular-nums; }
.chart-grid { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 16px; margin-bottom: 16px; }
.chart-card { padding: 20px 20px 12px; }
.chart-card h2 { margin-bottom: 4px; }
.chart-card .sub { color: var(--muted); font-size: 13px; }
.chart { width: 100%; display: block; margin-top: 16px; overflow: visible; }
.chart text { fill: var(--muted); font: 400 11px var(--mono); }
.chart .grid { stroke: var(--line); }
.chart .bar { fill: #3a3a3e; transition: fill .15s var(--ease); }
.chart .bar.accent { fill: var(--accent); }
.chart .hit:hover + .bar, .chart .bar:hover { fill: #5a5a60; }
.chart .hit:hover + .bar.accent, .chart .bar.accent:hover { fill: #5fd692; }
.tip { position: fixed; pointer-events: none; padding: 8px 10px; border-radius: 8px; background: var(--raised); border: 1px solid var(--line-strong); font: 400 12px/16px var(--mono); color: var(--text); z-index: 10; white-space: pre; }

/* tables */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { text-align: left; font-weight: 400; color: var(--muted); height: 36px; padding: 0 16px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { height: 40px; padding: 0 16px; border-bottom: 1px solid var(--line); white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: rgba(237,237,237,.02); }
th.r, td.r { text-align: right; font-family: var(--mono); font-variant-numeric: tabular-nums; }
td.zero { color: var(--muted); opacity: .6; }
.status-ok { color: var(--text-2); }
.status-err { color: #ff8a8d; }
.pager { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; border-top: 1px solid var(--line); color: var(--muted); font-size: 13px; }
.section-title { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--line); }

/* login */
.login { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.login-main { padding: 40px 64px; display: flex; flex-direction: column; justify-content: center; gap: 32px; max-width: 640px; }
.login-main h1 { font-size: 40px; letter-spacing: -.02em; line-height: 1.1; }
.login-main .lead { margin: 16px 0 0; font-size: 18px; line-height: 28px; color: var(--text-2); max-width: 32rem; }
.rules { display: grid; gap: 12px; }
.rules ol { margin: 0; padding: 0 0 0 20px; display: grid; gap: 8px; color: var(--text-2); font-size: 13px; line-height: 20px; }
.rules ol li::marker { font-family: var(--mono); color: var(--muted); }
.accept { display: flex; gap: 12px; align-items: flex-start; cursor: pointer; font-size: 14px; }
.accept input { width: 16px; height: 16px; margin: 2px 0 0; accent-color: var(--accent); flex: none; }
.gslot { min-height: 44px; display: flex; align-items: center; gap: 12px; }
.login-side { background: var(--bg-deep); border-left: 1px solid var(--line); padding: 40px 48px; display: flex; flex-direction: column; justify-content: center; gap: 16px; }
.login-side .card { padding: 4px 0; }
.err { color: #ff8a8d; font-size: 13px; min-height: 20px; }

/* admin forms */
.form { padding: 20px 24px; display: grid; gap: 16px; }
.form-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.prov-rows { display: grid; gap: 8px; }
.prov-row { display: grid; grid-template-columns: 32px minmax(0, 1fr) minmax(0, 1fr) auto; gap: 8px; align-items: center; }
.prov-row .pos { font: 400 12px var(--mono); color: var(--muted); text-align: center; }
.form-actions { display: flex; gap: 8px; align-items: center; }
.split { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 16px; align-items: start; }
.bar-list { list-style: none; margin: 0; padding: 8px 20px 16px; display: grid; gap: 12px; }
.bar-list li { display: grid; gap: 6px; }
.bar-list .top { display: flex; justify-content: space-between; gap: 12px; font-size: 13px; }
.bar-list .track { height: 4px; border-radius: 2px; background: var(--raised); }
.bar-list .fill { height: 4px; border-radius: 2px; background: #5a5a60; }
.bar-list li:first-child .fill { background: var(--accent); }
.badge-blocked { font: 400 12px var(--mono); color: #ff8a8d; }

.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); padding: 10px 16px; border-radius: 10px; background: var(--raised); border: 1px solid var(--line-strong); font-size: 13px; z-index: 20; transition: opacity .2s var(--ease); }

@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 12px; padding: 12px 16px; border-right: 0; border-bottom: 1px solid var(--line); }
  .nav { grid-auto-flow: column; overflow-x: auto; order: 3; width: 100%; }
  .nav a { white-space: nowrap; }
  .side-foot { margin: 0 0 0 auto; grid-auto-flow: column; align-items: center; padding: 0; }
  .balance { font-size: 18px; } .balance-label, .who { display: none; }
  main { padding: 24px 16px; }
  .key-grid, .chart-grid, .split, .form-row, .login { grid-template-columns: 1fr; }
  .stat-row { grid-template-columns: 1fr 1fr; }
  .login-main { padding: 40px 24px; } .login-main h1 { font-size: 32px; }
  .login-side { border-left: 0; border-top: 1px solid var(--line); padding: 32px 24px; }
  .model { grid-template-columns: 1fr; }
  .prov-row { grid-template-columns: 24px 1fr auto; } .prov-row input { grid-column: 2 / 4; }
}
.login-main .brand { padding: 0; }
#testLogin { display: flex; gap: 8px; } #testEmail { width: 220px; }
#newKey { flex: 1; }
section > .card + .card { margin-top: 16px; }
.login-gap { margin-top: 16px; }
.login-side .models .model { padding: 12px 16px; }

/* ----- chat ----- */
.chat-page:not([hidden]) { display: flex; flex-direction: column; height: calc(100vh - 64px); min-height: 520px; }
.chat-page .page-head { margin-bottom: 16px; }
.chat-bar { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-bottom: 16px; }
.chat-thread { flex: 1; min-height: 0; overflow-y: auto; background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 20px; display: flex; flex-direction: column; gap: 24px; }
.chat-thread > .empty { margin: auto; padding: 24px; max-width: 420px; }
.chat-turn { display: grid; gap: 12px; }
.chat-user { justify-self: end; max-width: 75%; background: var(--raised); border: 1px solid var(--line-strong); border-radius: 14px 14px 4px 14px; padding: 10px 14px; white-space: normal; overflow-wrap: anywhere; }
.chat-answers { display: grid; gap: 12px; }
.chat-answers.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.chat-answer { border: 1px solid var(--line); border-radius: 12px; background: var(--bg); display: flex; flex-direction: column; min-width: 0; }
.chat-head { display: flex; justify-content: space-between; gap: 12px; padding: 10px 14px; border-bottom: 1px solid var(--line); font-weight: 500; font-size: 13px; }
.chat-head .mono { font-size: 12px; font-weight: 400; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-body { padding: 12px 14px; min-width: 0; overflow-wrap: anywhere; }
.chat-foot { padding: 0 14px 10px; color: var(--muted); font: 400 12px var(--mono); }
.chat-foot:empty { display: none; }
.chat-wait { color: var(--muted); animation: chatPulse 1.4s ease-in-out infinite; }
@keyframes chatPulse { 50% { opacity: .4; } }
.chat-err { color: #ff8a8d; margin-top: 4px; }
.chat-note { color: var(--muted); font-size: 13px; margin-top: 8px; }
.chat-think { margin-bottom: 10px; border-left: 2px solid var(--line-strong); padding-left: 10px; }
.chat-think summary { cursor: pointer; color: var(--muted); font-size: 13px; }
.chat-think-body { color: var(--text-2); font-size: 13px; margin-top: 6px; max-height: 260px; overflow-y: auto; }
.chat-composer { display: flex; gap: 12px; align-items: flex-end; margin-top: 16px; }
.chat-composer textarea { flex: 1; min-height: 48px; max-height: 240px; resize: vertical; }
.chat-composer .btn { height: 48px; min-width: 120px; }

/* markdown inside answers */
.md > :first-child { margin-top: 0; } .md > :last-child { margin-bottom: 0; }
.md p, .md ul, .md ol, .md blockquote, .md .md-code, .md .md-table { margin: 0 0 12px; }
.md h2, .md h3, .md h4, .md h5, .md h6 { margin: 18px 0 8px; line-height: 1.3; font-weight: 600; }
.md h2 { font-size: 20px; } .md h3 { font-size: 17px; } .md h4, .md h5, .md h6 { font-size: 15px; }
.md ul, .md ol { padding-left: 22px; } .md li + li { margin-top: 4px; }
.md a { color: var(--accent); }
.md code { font-family: var(--mono); font-size: 13px; background: var(--raised); border-radius: 4px; padding: 1px 5px; }
.md .md-code { background: var(--bg-deep); border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.md .md-lang { font: 400 11px var(--mono); color: var(--muted); padding: 6px 12px; border-bottom: 1px solid var(--line); }
.md pre { margin: 0; padding: 12px; overflow-x: auto; }
.md pre code { background: none; padding: 0; font-size: 13px; line-height: 20px; white-space: pre; }
.md blockquote { border-left: 3px solid var(--line-strong); padding-left: 12px; color: var(--text-2); }
.md hr { border: 0; border-top: 1px solid var(--line); margin: 16px 0; }
.md .md-table { overflow-x: auto; border: 1px solid var(--line); border-radius: 8px; }
.md table { font-size: 13px; } .md th, .md td { white-space: normal; height: auto; padding: 8px 12px; }
.md .a-center { text-align: center; } .md .a-right { text-align: right; }
.md del { color: var(--muted); }
@media (max-width: 900px) {
  .chat-page:not([hidden]) { height: auto; }
  .chat-thread { min-height: 360px; max-height: 70vh; }
  .chat-bar, .chat-answers.two { grid-template-columns: 1fr; }
  .chat-user { max-width: 90%; }
}

/* access to Telegram-gated models */
.access-card { padding: 20px; margin-bottom: 16px; display: grid; gap: 16px; border-color: rgba(70,195,123,.35); }
.access-head h2 { margin: 0; font-size: 16px; } .access-head p { margin: 6px 0 0; color: var(--text-2); }
.access-steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.access-steps li { display: flex; align-items: center; gap: 12px; min-height: 32px; }
.step-mark { width: 22px; height: 22px; border-radius: 50%; border: 1px solid var(--line-strong); display: grid; place-items: center; flex: none; }
.access-steps li.done .step-mark { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.access-steps li.done .step-title { color: var(--text-2); }
.step-mark .icon { width: 14px; height: 14px; stroke-width: 2.4; }
.step-title { flex: 1; }
.tg-tag { color: var(--accent); }
.net-tag { color: #e5a83b; }
.new-badge { margin-left: auto; font: 500 11px/16px var(--sans); color: var(--accent-ink); background: var(--accent); padding: 1px 7px; border-radius: 999px; }
.giveaway { display: grid; gap: 8px; padding: 12px; border-radius: 10px; background: rgba(70,195,123,.12); border: 1px solid rgba(70,195,123,.55); }
.giveaway-title { font-weight: 500; color: var(--accent); }
.giveaway-text { font-size: 13px; line-height: 18px; color: var(--text); }
.giveaway .btn { width: 100%; }
.free-line { margin-top: 6px; font-size: 12px; line-height: 16px; color: var(--accent); }
.bonus-card { padding: 20px; margin-bottom: 16px; }
.bonus-head { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.bonus-card p { margin: 8px 0 0; }
.bonus-card .small { font-size: 12px; }
.bonus-card .access-steps { margin: 14px 0 0; }
.bonus-actions { display: flex; gap: 12px; align-items: center; margin-top: 14px; }
.progress-line { height: 6px; border-radius: 3px; background: var(--raised); margin-top: 12px; overflow: hidden; }
.progress-line .fill { height: 100%; background: var(--accent); width: 0; }
.ref-link { display: inline-flex; gap: 8px; align-items: center; margin-top: 12px; padding: 8px 12px; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--bg-deep); }
.net-link { padding: 20px; margin-bottom: 16px; border-color: rgba(70,195,123,.5); }
.net-link p { color: var(--text-2); margin: 8px 0 14px; }
.net-actions { display: flex; gap: 10px; }
.net-download { padding: 20px; display: flex; gap: 24px; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.net-download p { margin: 8px 0 0; max-width: 680px; }
.net-files { display: grid; gap: 8px; justify-items: end; flex-shrink: 0; }
#netNodes td { vertical-align: top; }
.chat-page .access-card { margin-bottom: 16px; }

/* TTS models */
.kind-seg { justify-self: start; }
.tts-tag { color: #8fb7ff; font-family: var(--mono); }

/* chat: TTS mode */
.chat-head-actions { display: flex; gap: 12px; align-items: center; }
.chat-bar.tts { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.chat-body audio { width: 100%; height: 40px; display: block; }
@media (max-width: 900px) { .chat-bar.tts { grid-template-columns: 1fr; } .chat-head-actions { flex-wrap: wrap; } }

/* models list: search and sorting */
.models-bar { display: flex; gap: 12px; margin-bottom: 16px; }
.models-bar input[type=search] { flex: 1; height: 36px; padding: 0 12px; border-radius: 8px; border: 1px solid var(--line-strong); background: var(--bg-deep); color: var(--text); font: 400 14px/1 var(--sans); }
.models-bar input[type=search]:focus { outline: none; border-color: var(--text-2); }
.models-bar select { width: auto; min-width: 220px; }
.model-by { color: var(--muted); font-size: 13px; margin-top: 2px; }
.model-by:empty { display: none; }
.model-by .info-link { color: var(--text-2); text-decoration: none; white-space: nowrap; }
.model-by .info-link:hover { color: var(--text); text-decoration: underline; }
@media (max-width: 900px) { .models-bar { flex-direction: column; } .models-bar select { width: 100%; } }
input[type=date] { color-scheme: dark; }

.model-side { display: flex; align-items: center; gap: 12px; }
.model-usage { color: var(--text-2); font-size: 13px; white-space: nowrap; font-variant-numeric: tabular-nums; }
@media (max-width: 900px) { .model-side { justify-content: space-between; } }
/* narrow landing panel: usage and ID go under the model info */
.login-side .model { grid-template-columns: minmax(0, 1fr); gap: 10px; }
.login-side .model-side { justify-content: space-between; }

/* models list: type switch and author filter */
.models-bar .seg { flex: none; align-self: center; }
.author-filter { position: relative; flex: none; }
.author-filter summary { list-style: none; min-width: 170px; justify-content: space-between; }
.author-filter summary::-webkit-details-marker { display: none; }
.author-filter summary::after { content: ''; width: 6px; height: 6px; border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: rotate(45deg) translateY(-2px); margin-left: 6px; }
.author-pop { position: absolute; right: 0; top: calc(100% + 6px); z-index: 10; width: 280px; max-height: 360px; display: flex; flex-direction: column; background: var(--raised); border: 1px solid var(--line-strong); border-radius: 10px; box-shadow: 0 12px 32px rgba(0,0,0,.45); }
.author-actions { display: flex; justify-content: space-between; padding: 6px; border-bottom: 1px solid var(--line); }
.author-list { overflow-y: auto; padding: 6px 4px; }
.author-list .accept { padding: 7px 10px; border-radius: 6px; align-items: center; }
.author-list .accept:hover { background: var(--bg); }
.author-list .accept input { margin: 0; }
.author-list .accept span:first-of-type { flex: 1; }
@media (max-width: 900px) { .author-filter, .author-filter summary { width: 100%; } .author-pop { left: 0; right: auto; width: 100%; } }
.dot.down { background: #ff8a8d; opacity: 1; }

/* admin: intelligence per reasoning level */
.intel-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 8px; margin-top: 8px; }
.intel-cell { display: flex; flex-direction: column; gap: 4px; font: 400 12px/1.2 var(--mono); color: var(--muted); }
@media (max-width: 900px) { .intel-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
/* SmartRouter card on the Models page */
.smart-card h2 { margin: 0 0 6px; font-size: 16px; }
.smart-card p { margin: 0 0 10px; color: var(--text-2); font-size: 14px; line-height: 1.5; }
.smart-card .chip { margin-right: 6px; }
.smart-card { padding: 20px; margin-bottom: 16px; }
.chat-bar.smart { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 220px; }
@media (max-width: 900px) { .chat-bar.smart { grid-template-columns: minmax(0, 1fr); } }
.log-filters { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.log-filters select { height: 32px; background: var(--bg-deep); color: var(--text); border: 1px solid var(--line-strong); border-radius: 8px; padding: 0 8px; max-width: 260px; }
.log-filters .check { display: inline-flex; gap: 6px; align-items: center; color: var(--text-2); font-size: 13px; }
.log-table tr.clickable { cursor: pointer; }
.log-table tr.clickable:hover td { background: rgba(237,237,237,.03); }
.log-table .nowrap { white-space: nowrap; }
.log-preview { max-width: 320px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-2); }
.log-modal { width: min(1000px, 94vw); max-height: 90vh; padding: 20px; background: var(--card); color: var(--text); border: 1px solid var(--line-strong); border-radius: 12px; }
.log-modal::backdrop { background: rgba(0,0,0,.6); }
.log-modal-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.log-modal-head h2 { margin: 0; }
.log-modal h3 { margin: 16px 0 6px; font-size: 13px; color: var(--text-2); font-weight: 500; }
.log-meta { margin-top: 8px; font-size: 13px; color: var(--text-2); line-height: 20px; }
.log-body { margin: 0; max-height: 38vh; overflow: auto; padding: 12px; background: var(--bg-deep); border: 1px solid var(--line); border-radius: 8px; font: 12px/18px var(--mono, monospace); white-space: pre-wrap; word-break: break-word; }

/* API keys list, Agents page */
.key-new { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; align-items: end; }
.key-list { margin-top: 16px; }
.agent-panel { max-width: 920px; }
.agent-step { display: grid; gap: 8px; }
.agent-step .label, .agent-out .label { font-size: 13px; color: var(--text-2); }
.agent-pick { display: flex; flex-wrap: wrap; gap: 8px; }
.agent-chip { height: 32px; padding: 0 14px; border-radius: 8px; border: 1px solid var(--line-strong); background: var(--bg-deep); color: var(--text-2); font: 400 13px/1 var(--sans); cursor: pointer; transition: background-color .15s var(--ease), color .15s var(--ease), border-color .15s var(--ease); }
.agent-chip:hover { color: var(--text); }
.agent-chip[aria-pressed=true] { color: var(--text); border-color: rgba(70,195,123,.6); background: rgba(70,195,123,.1); }
.agent-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 16px; align-items: end; }
.agent-row .seg { height: 36px; align-items: center; }
.agent-out { display: grid; gap: 8px; }
.agent-cmd { font-size: 12.5px; line-height: 19px; }
.agent-panel .small { font-size: 12.5px; margin: 0; }
.access-note { padding: 10px 14px; border-radius: 8px; border: 1px solid rgba(229,72,77,.35); color: var(--text-2); font-size: 13px; }
@media (max-width: 900px) { .agent-row, .key-new { grid-template-columns: 1fr; } }

/* Decider tab in the chat */
.decide-panel { padding: 20px; display: grid; gap: 16px; align-content: start; overflow-y: auto; }
.decide-about { margin: 0; font-size: 13px; }
.dec-opts { display: grid; gap: 8px; }
.dec-opt { display: flex; gap: 8px; }
.dec-opt input { flex: 1; min-width: 0; }
.dec-actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.dec-result { display: grid; gap: 8px; }
.dec-res { position: relative; display: flex; justify-content: space-between; gap: 12px; padding: 10px 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); overflow: hidden; }
.dec-res i { position: absolute; inset: 0 auto 0 0; background: rgba(70, 195, 123, .14); }
.dec-res.best { border-color: var(--accent); }
.dec-res .dec-text, .dec-res .dec-pct { position: relative; }
.dec-res .dec-text { overflow-wrap: anywhere; }
.dec-res .dec-pct { font-family: var(--mono); font-size: 13px; white-space: nowrap; }
.free-tag { color: var(--accent); }
