/* New API — Copyright (c) 2025 QuantumNous. SPDX-License-Identifier: AGPL-3.0-or-later */
:root {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #192b41;
  background: #f4f7fb;
  font-synthesis: none;
  line-height: 1.55;
  --accent: #1856ad;
  --muted: #52627a;
  --border: #d5deeb;
  --danger: #a82232;
}
* { box-sizing: border-box; }
body { margin: 0; min-width: 280px; }
button, input, select, textarea { font: inherit; }
button, select, input[type="checkbox"] { cursor: pointer; }
button:disabled, input:disabled, select:disabled, textarea:disabled { cursor: not-allowed; opacity: .6; }
[hidden] { display: none !important; }
h1, h2, p { margin: 0; }
h1 { font-size: clamp(1.35rem, 3vw, 1.9rem); line-height: 1.3; }
h2 { font-size: 1.1rem; }
p, dd, h1, h2, .notice { overflow-wrap: anywhere; }
:focus-visible { outline: 3px solid #2b71cc; outline-offset: 3px; }
.main:focus { outline: none; }
.site-header, .tabs, .main, .site-footer { width: min(1160px, 100%); margin-inline: auto; }
.site-header { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 1.35rem 1.25rem; flex-wrap: wrap; }
.brand { display: grid; gap: .15rem; }
.brand strong { color: #173960; font-size: 1.2rem; }
.header-tools { display: flex; align-items: end; gap: .75rem; flex-wrap: wrap; }
.header-tools .field { gap: .15rem; }
.header-tools .label { font-size: .75rem; }
.tabs { display: flex; gap: .3rem; padding: .25rem 1.25rem 0; border-bottom: 1px solid var(--border); overflow-x: auto; }
.tab { background: transparent; color: var(--muted); border: 0; border-bottom: 3px solid transparent; padding: .85rem 1rem; white-space: nowrap; min-height: 44px; font-weight: 650; }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); }
.tab:hover:not(:disabled) { background: #eaf0f9; }
.main { padding: 1.5rem 1.25rem 2.5rem; min-height: 62vh; }
.site-footer { text-align: center; font-size: .78rem; color: var(--muted); padding: 1.25rem; border-top: 1px solid var(--border); }
.site-footer p + p { margin-top: .4rem; }
.stack { display: grid; grid-template-columns: minmax(0, 1fr); gap: 1rem; }
.card { background: #fff; border: 1px solid var(--border); border-radius: 14px; padding: 1.2rem; box-shadow: 0 3px 12px #253d6610; min-width: 0; }
.login-card { width: min(460px, 100%); margin: 2rem auto; display: grid; gap: 1.1rem; padding: 1.6rem; }
.hint { color: var(--muted); font-size: .875rem; font-weight: 400; }
.label { font-size: .9rem; font-weight: 650; }
.field { display: grid; align-content: start; gap: .4rem; min-width: 0; }
.input { width: 100%; min-width: 0; min-height: 44px; color: #192b41; background: #fff; border: 1px solid #a9b8cc; border-radius: 7px; padding: .55rem .7rem; }
textarea.input { resize: vertical; }
input[readonly] { background: #f3f6fa; }
input[type="checkbox"] { width: 21px; height: 21px; min-height: 21px; accent-color: var(--accent); margin: 0; }
.language { width: auto; }
.button { min-height: 44px; border: 1px solid var(--accent); border-radius: 8px; padding: .5rem .85rem; color: var(--accent); background: #f4f8ff; font-weight: 600; line-height: 1.4; text-align: center; }
.button:hover:not(:disabled) { background: #e5eefc; }
.button.primary { background: var(--accent); color: white; }
.button.primary:hover:not(:disabled) { background: #12448c; }
.button.secondary { color: #314661; background: white; border-color: #acbbce; }
.button.secondary:hover:not(:disabled) { background: #f0f4fa; }
.button.danger { color: white; background: var(--danger); border-color: var(--danger); }
.button.danger.secondary { color: var(--danger); background: #fff8f8; }
.actions { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; }
.section-heading { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: .8rem; }
.notice { padding: .75rem 1rem; color: #1a477e; background: #eaf3ff; border: 1px solid #afc9e9; border-radius: 8px; font-size: .9rem; }
.notice.error { color: #882030; background: #fff1f2; border-color: #e0a4ad; }
.empty { padding: 2rem 1rem; color: var(--muted); text-align: center; }
.stat-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; }
.stat { display: grid; gap: .5rem; }
.stat-value { font-size: clamp(1.15rem, 3vw, 1.8rem); font-weight: 750; color: #153c72; font-variant-numeric: tabular-nums; }
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(155px, 1fr)); gap: 1rem; margin: 0; }
.facts dt { color: var(--muted); font-size: .8rem; }
.facts dd { margin: .2rem 0 0; font-size: .95rem; }
.token-list { display: grid; gap: 1rem; }
.token-card { display: grid; gap: 1rem; }
.token-name { overflow-wrap: anywhere; }
.badge { display: inline-block; padding: .2rem .65rem; font-size: .8rem; border-radius: 30px; background: #eaf0f9; color: #314f7b; }
.copy-row { display: flex; align-items: end; gap: .7rem; }
.copy-row .field { flex: 1; }
.copy-row .input { font-family: ui-monospace, "Cascadia Code", monospace; }
.model-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: .65rem; list-style: none; padding: 0; margin: 0; }
.model-name { background: white; border: 1px solid var(--border); border-radius: 8px; padding: .8rem; overflow-wrap: anywhere; font-family: ui-monospace, monospace; font-size: .875rem; }
.filter-form { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; align-items: end; }
.filter-form .actions { grid-column: 1 / -1; }
.table-scroll { overflow-x: auto; padding: 0; }
.usage-table { width: 100%; border-collapse: collapse; text-align: left; font-size: .85rem; }
.usage-table th, .usage-table td { padding: .85rem; border-bottom: 1px solid var(--border); vertical-align: top; }
.usage-table th { background: #edf2f8; color: #334b6a; white-space: nowrap; }
.usage-table td { min-width: 95px; max-width: 260px; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.usage-table td:first-child { min-width: 160px; }
.usage-table tr:last-child td { border-bottom: 0; }
.pager { display: flex; align-items: center; justify-content: center; gap: 1rem; flex-wrap: wrap; margin-top: 1.2rem; }
.modal { width: min(760px, calc(100vw - 2rem)); max-height: calc(100dvh - 2rem); padding: 0; border: 1px solid var(--border); border-radius: 14px; color: #192b41; background: white; box-shadow: 0 20px 70px #152c4e40; }
.modal::backdrop { background: #13243bcc; }
.modal-heading { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 1rem 1.2rem; border-bottom: 1px solid var(--border); position: sticky; top: 0; background: white; z-index: 1; }
.modal-body { display: grid; gap: 1rem; padding: 1.2rem; }
.modal > .notice { margin: 0 1.2rem 1.2rem; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.15rem; }
.toggle { grid-template-columns: 24px 1fr; column-gap: .7rem; align-items: center; }
.toggle .label { grid-column: 2; grid-row: 1; cursor: pointer; }
.toggle input { grid-column: 1; grid-row: 1; }
.toggle .hint { grid-column: 2; }
.model-choices { max-height: 260px; overflow-y: auto; border: 1px solid var(--border); border-radius: 8px; padding: .75rem; display: grid; gap: .7rem; }
.model-choice { grid-template-columns: 24px 1fr; gap: .2rem .65rem; align-items: center; }
.model-choice .label { grid-column: 2; grid-row: 1; overflow-wrap: anywhere; }
.model-choice input { grid-column: 1; grid-row: 1; }
.model-choice .hint { grid-column: 2; }
.captcha { min-height: 65px; overflow: hidden; }
.boot-message { text-align: center; margin: 2rem 1rem; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; }
@media (max-width: 680px) {
  .site-header { padding: 1rem; gap: .75rem; }
  .brand .hint { display: none; }
  .tabs { padding-inline: .5rem; }
  .tab { padding-inline: .8rem; }
  .main { padding: 1rem .75rem 2rem; }
  .stat-grid { grid-template-columns: 1fr; gap: .65rem; }
  .stat { grid-template-columns: 1fr auto; align-items: center; }
  .stat-value { text-align: right; }
  .card { padding: 1rem; }
  .table-scroll { padding: 0; }
  .form-grid, .filter-form { grid-template-columns: 1fr; }
  .login-card { margin-top: 1rem; }
  .modal { width: calc(100vw - 1rem); max-height: calc(100dvh - 1rem); }
  .modal-body { padding: 1rem; }
  .modal-heading { padding: .8rem 1rem; }
  .model-list { grid-template-columns: 1fr; }
  .copy-row { flex-wrap: wrap; }
  .copy-row .field { flex-basis: 100%; }
  .pager { gap: .65rem; }
  .pager .hint { flex-basis: 100%; text-align: center; order: -1; }
  .header-tools { gap: .4rem; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; }
}
