:root { --ink: #20262d; --muted: #69737e; --line: #e2e6ea; --surface: #f6f8fa; --panel: #fff; --soft: #f4f6f8; --accent: #198754; }
:root[data-bs-theme="dark"] { --ink: #e6edf3; --muted: #9aa7b4; --line: #303943; --surface: #151a1f; --panel: #1d242b; --soft: #252e37; --accent: #43c98a; }
* { box-sizing: border-box; }
body { margin: 0; color: var(--ink); background: var(--surface); font-family: system-ui, -apple-system, "Segoe UI", sans-serif; font-size: 14px; letter-spacing: 0; }
[hidden] { display: none !important; }
a { color: var(--accent); }
button, input, select { font: inherit; }
button svg, a svg { width: 17px; height: 17px; flex-shrink: 0; }
.btn { display: inline-flex; gap: 8px; align-items: center; justify-content: center; border-radius: 5px; font-size: 14px; min-height: 34px; }
.form-control, .form-select { border-radius: 5px; font-size: 14px; }
:root[data-bs-theme="light"] .form-control, :root[data-bs-theme="light"] .form-select { background-color: #fff; color: var(--ink); }
:root[data-bs-theme="light"] .auth-form .form-control { background-color: #fff; color: #20262d; }
.form-label { font-size: 13px; font-weight: 500; }
.boot-state { min-height: 100dvh; display: grid; place-items: center; }
.auth-shell { min-height: 100dvh; display: grid; place-items: center; padding: 36px 20px; background: var(--panel); }
.auth-form { width: 100%; max-width: 360px; }
.auth-brand-row { display: flex; align-items: center; gap: 12px; margin-bottom: 30px; min-width: 0; }
.auth-brand-row .brand-image { flex-shrink: 0; }
.auth-brand { margin: 0; font-size: 28px; font-weight: 650; overflow-wrap: anywhere; min-width: 0; }
.auth-mode { margin-bottom: 28px; }
.auth-mode .btn { min-height: 40px; }
.auth-form .form-control { min-height: 44px; }
.auth-form #auth-submit { min-height: 44px; }
.topbar { height: 62px; position: fixed; inset: 0 0 auto; display: flex; align-items: center; justify-content: space-between; padding: 0 24px; background: var(--panel); border-bottom: 1px solid var(--line); z-index: 30; gap: 16px; }
.brand { display: flex; align-items: center; gap: 10px; font-size: 18px; font-weight: 650; text-decoration: none; color: var(--ink); min-width: 0; }
.brand span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar-right { display: flex; gap: 16px; align-items: center; min-width: 0; }
.account-email { color: var(--muted); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 260px; }
.icon-button { width: 34px; height: 34px; display: inline-grid; place-items: center; color: var(--muted); border: 1px solid transparent; background: transparent; border-radius: 5px; flex-shrink: 0; }
.icon-button:hover { background: var(--soft); color: var(--ink); }
.icon-button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.icon-button svg { width: 18px; height: 18px; }
.icon-button.danger { color: #bd3544; }
.mobile-menu { display: none; }
.sidebar { position: fixed; top: 62px; bottom: 0; left: 0; width: 220px; padding: 30px 12px 18px; background: var(--panel); border-right: 1px solid var(--line); display: flex; flex-direction: column; z-index: 25; }
.nav-label { font-size: 10px; color: #929ba4; padding: 0 14px; margin-bottom: 10px; font-weight: 600; }
.sidebar nav a { display: flex; gap: 11px; align-items: center; min-height: 42px; padding: 10px 14px; margin-bottom: 4px; border-radius: 5px; text-decoration: none; color: #58636e; font-size: 13px; font-weight: 500; }
:root[data-bs-theme="dark"] .sidebar nav a { color: #a4a8ad; }
.sidebar nav a:hover { background: var(--soft); }
.sidebar nav a.active { background: #eaf5ef; color: #167348; }
.sidebar-bottom { margin-top: auto; display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 10px; padding: 14px 8px 0; border-top: 1px solid var(--line); }
.status-dot { width: 6px; height: 6px; border-radius: 50%; background: #d39c28; flex-shrink: 0; }
.status-dot.online { background: var(--accent); }
.status-dot.offline { background: #bd3544; }
.version { margin-left: auto; color: #929ba4; }
.workspace { margin: 62px 0 0 220px; padding: 32px 36px 48px; max-width: 1800px; }
.page-heading { display: flex; justify-content: space-between; align-items: center; margin-bottom: 28px; gap: 16px; }
.breadcrumb-line { font-size: 11px; color: #8b949d; margin-bottom: 8px; }
.breadcrumb-line span { margin-left: 6px; }
.page-heading h1 { font-size: 26px; line-height: 1.25; font-weight: 630; margin: 0; }
.heading-actions { display: flex; gap: 10px; align-items: center; flex-shrink: 0; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 20px; flex-wrap: wrap; }
.section-head h2 { font-size: 16px; font-weight: 600; margin: 0; }
.section-head .form-select { width: auto; max-width: 100%; }
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); background: var(--panel); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); margin-bottom: 30px; }
.stat { padding: 24px; border-right: 1px solid var(--line); min-width: 0; }
.stat:last-child { border: 0; }
.stat-label { color: var(--muted); font-size: 12px; display: flex; align-items: center; gap: 7px; margin-bottom: 12px; }
.stat-label svg { width: 15px; height: 15px; }
.stat-value { font-size: 25px; line-height: 1.25; font-weight: 600; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.stat-value .unit { font-size: 12px; color: var(--muted); font-weight: 400; }
.stat-detail { font-size: 11px; color: var(--muted); margin-top: 8px; }
.chart-section { background: var(--panel); padding: 24px; margin-bottom: 30px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.legend { display: flex; gap: 18px; font-size: 11px; color: var(--muted); flex-wrap: wrap; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 8px; height: 8px; border-radius: 2px; background: #198754; }
.legend i.output { background: #8094a6; }
.chart-wrap { height: 230px; width: 100%; position: relative; }
canvas { width: 100%; height: 100%; display: block; }
.table-section { background: var(--panel); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.table-section .section-head { padding: 20px 24px 0; }
.table { margin: 0; min-width: 720px; font-size: 12px; --bs-table-color: var(--ink); }
.table th { color: #7a8590; font-size: 11px; font-weight: 500; background: #fafbfc; border-bottom-color: var(--line); white-space: nowrap; }
:root[data-bs-theme="dark"] .table th { background: var(--soft); color: var(--muted); }
.table td, .table th { padding: 14px 18px; vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table-responsive { width: 100%; }
.table .numeric { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.table .mono { font-size: 11px; }
.mono { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; }
.subcell { font-size: 10px; color: #89939d; margin-top: 4px; }
.badge-status { display: inline-flex; align-items: center; gap: 5px; font-size: 10px; padding: 4px 7px; border-radius: 4px; white-space: nowrap; background: #eaf5ef; color: #167348; }
.badge-status.failed, .badge-status.revoked { background: #fbeef0; color: #a72f3e; }
.badge-status.usage_unknown { background: #fff4df; color: #986e17; }
.badge-status.processing { background: #edf1f5; color: #5a6e82; }
.badge-status.waived { background: #f0f1f3; color: #737c86; }
.unavailable-status { display: inline-block; color: #a72f3e; font-size: 11px; min-width: 140px; line-height: 1.4; }
.empty { text-align: center; padding: 48px 24px; color: var(--muted); }
.empty svg { display: block; width: 30px; height: 30px; margin: 0 auto 14px; color: #a5afb9; }
.empty-title { font-size: 14px; color: #596470; }
.empty .btn { margin-top: 18px; }
.pager { display: flex; gap: 8px; align-items: center; justify-content: flex-end; border-top: 1px solid var(--line); padding: 12px 18px; font-size: 11px; color: var(--muted); }
.pager .icon-button { border-color: var(--line); width: 28px; height: 28px; }
.filters { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.filter-control { max-width: 220px; }
.balance-band { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 24px; padding: 28px 0; margin-bottom: 24px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.balance-band .stat-value { font-size: 36px; }
.balance-details { display: flex; gap: 40px; flex-wrap: wrap; }
.balance-details strong { display: block; margin-top: 6px; font-size: 18px; font-weight: 500; }
.alert { font-size: 13px; border-radius: 5px; }
.loading { padding: 70px 24px; text-align: center; color: var(--muted); }
.loading .spinner-border { width: 22px; height: 22px; }
.key-secret { padding: 14px; background: #f4f6f8; border: 1px solid var(--line); border-radius: 5px; overflow-wrap: anywhere; font-size: 13px; user-select: all; }
:root[data-bs-theme="dark"] .key-secret, :root[data-bs-theme="dark"] .connection-field code { background: var(--soft); }
.modal-content { border-radius: 8px; border: 1px solid var(--line); }
.modal-header { padding: 20px 24px; }
.modal-body { padding: 24px; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 24px; }
.modal-error { margin-top: 16px; }
.model-options { display: flex; flex-wrap: wrap; gap: 10px 22px; }
.connection-field { margin-bottom: 18px; }
.connection-field code { display: block; padding: 12px; background: #f4f6f8; color: var(--ink); border-radius: 4px; overflow-wrap: anywhere; }
.model-name { font-weight: 600; }
.name-cell { min-width: 120px; max-width: 220px; overflow-wrap: anywhere; }
.nav-backdrop { position: fixed; inset: 62px 0 0; background: #20262d55; border: 0; z-index: 24; }
.sidebar { overflow-y: auto; }
.help-article { max-width: 900px; min-width: 0; }
.help-article section { padding: 24px 0; border-top: 1px solid var(--line); }
.help-article h2 { font-size: 18px; margin-bottom: 16px; }
.help-article p { line-height: 1.7; overflow-wrap: anywhere; }
.help-topics { padding-bottom: 20px; }
.help-page-link { display: flex; align-items: center; gap: 12px; padding: 18px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); text-decoration: none; color: var(--ink); }
.help-page-link svg:last-child { margin-left: auto; }
.help-page-link:hover { color: var(--accent); }
.help-settings dt { margin-top: 14px; }
.help-settings dd { margin-top: 6px; overflow-wrap: anywhere; }
.help-code { margin: 16px 0; background: var(--panel); border: 1px solid var(--line); border-radius: 5px; min-width: 0; }
.help-code-heading { display: flex; align-items: center; justify-content: space-between; padding: 6px 12px; border-bottom: 1px solid var(--line); color: var(--muted); }
.help-code pre { margin: 0; padding: 16px; overflow-x: auto; color: var(--ink); font-size: 12px; }
.help-article .table { min-width: 0; }
.model-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.model-card { text-align: left; color: var(--ink); background: var(--panel); border: 1px solid var(--line); border-radius: 6px; padding: 18px; cursor: pointer; }
.model-card:hover, .model-card:focus-visible { border-color: var(--accent); box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 20%, transparent); }
.model-card.priority { border: 2px solid var(--accent); padding: 17px; }
.model-card-top, .model-card-prices, .model-card-meta { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.model-card-prices { margin: 24px 0 18px; justify-content: flex-start; gap: 28px; }
.model-card-prices span, .model-card-meta, .model-metrics span { color: var(--muted); font-size: 11px; }
.model-card-prices strong { display: block; color: var(--ink); font-size: 18px; margin-top: 5px; }
.model-card-meta svg { width: 15px; height: 15px; margin-left: auto; }
.model-detail-head, .model-metrics { display: flex; justify-content: space-between; align-items: center; gap: 16px; }
.model-detail-head h3 { margin: 5px 0 0; font-size: 21px; }
.model-provider { color: var(--muted); font-size: 12px; }
.model-metrics { margin: 24px 0; padding: 16px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.model-metrics strong { display: block; margin-top: 5px; font-size: 16px; }
.modal-body h4 { font-size: 14px; margin: 22px 0 12px; }
.model-detail-dialog { --bs-modal-width: 900px; }
@media (max-width: 700px) { .model-detail-dialog { --bs-modal-width: calc(100vw - 1rem); } }
@media (max-width: 850px) { .model-grid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 550px) { .model-grid { grid-template-columns: 1fr; } .model-metrics { align-items: flex-start; flex-wrap: wrap; } }
@media (min-width: 1600px) { .workspace { padding: 40px 56px; } }
@media (max-width: 1100px) { .workspace { padding: 28px 24px; } .stat { padding: 20px 16px; } .stat-value { font-size: 23px; } }
@media (max-width: 850px) { .sidebar { width: 200px; } .workspace { margin-left: 200px; padding: 24px 18px; } .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); } .stat:nth-child(2) { border-right: 0; } .stat:nth-child(-n+2) { border-bottom: 1px solid var(--line); } .stat:nth-child(3) { border-right: 1px solid var(--line); } }
@media (max-width: 650px) { .topbar { padding: 0 14px; gap: 8px; } .topbar .brand { font-size: 16px; margin-right: auto; } .brand img { width: 26px; height: 26px; } .account-email { display: none; } .topbar-right { gap: 0; } .mobile-menu { display: inline-grid; } .sidebar { transform: translateX(-100%); transition: transform .15s ease; width: 220px; } .sidebar.open { transform: translateX(0); } .workspace { margin-left: 0; padding: 24px 16px 36px; } .page-heading { margin-bottom: 24px; } .page-heading h1 { font-size: 23px; } .heading-actions { gap: 4px; } .chart-section { padding: 20px 16px; } .chart-section .section-head { align-items: flex-start; } .chart-wrap { height: 200px; } .stat { padding: 18px 14px; } .stat-value { font-size: 22px; } .stat-label { font-size: 11px; } .table-section .section-head { padding: 18px 16px 0; } .table td, .table th { padding: 12px 14px; } .balance-band .stat-value { font-size: 30px; } .balance-details { gap: 24px; } .filter-control { max-width: 160px; } .modal-body, .modal-header { padding: 20px; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; animation: none !important; } }
