  /* ---------- Cards / Stats ---------- */
  .cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; margin-bottom: 22px; }
  .card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 16px 18px;
  }
  .card .label { color: var(--text-dim); font-size: 12px; text-transform: uppercase; letter-spacing: .05em; }
  .card .value { font-size: 24px; font-weight: 700; margin-top: 4px; font-variant-numeric: tabular-nums; }
  .card .hint { color: var(--text-dim); font-size: 12px; margin-top: 2px; }
  .panel {
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 18px 20px;
    margin-bottom: 18px;
  }
  .panel h2 { font-size: 15px; font-weight: 600; margin-bottom: 12px; }
  /* ---------- Tables ---------- */
  table { width: 100%; border-collapse: collapse; font-size: 13px; }
  thead th {
    text-align: left;
    color: var(--text-dim);
    font-size: 11.5px;
    text-transform: uppercase;
    letter-spacing: .05em;
    padding: 8px 10px;
    border-bottom: 1px solid var(--border);
    position: sticky; top: 0;
    background: var(--bg-panel);
    z-index: 1;
  }
  tbody td { padding: 9px 10px; border-bottom: 1px solid var(--border); vertical-align: middle; }
  tbody tr:hover { background: var(--bg-hover); }
  tbody tr.clickable { cursor: pointer; }
  .table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: 10px; background: var(--bg-panel); }
  td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
  .mono { font-family: var(--mono); font-size: 12px; }
  /* ---------- Badges ---------- */
  .badge {
    display: inline-block;
    padding: 2px 9px;
    border-radius: 999px;
    font-size: 11.5px;
    font-weight: 600;
    line-height: 1.6;
  }
  .badge.green  { background: rgba(34,197,94,.15);  color: var(--green); }
  .badge.yellow { background: rgba(234,179,8,.15);  color: var(--yellow); }
  .badge.gold   { background: rgba(245,158,11,.15); color: #f59e0b; }
  .badge.red    { background: rgba(239,68,68,.15);  color: var(--red); }
  .badge.blue   { background: rgba(59,130,246,.15); color: var(--accent); }
  .badge.gray   { background: rgba(154,163,181,.15); color: var(--text-dim); }
  /* ---------- Buttons ---------- */
  .btn {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 7px 14px;
    border-radius: 7px;
    border: 1px solid transparent;
    font-size: 13px; font-weight: 600;
    cursor: pointer;
    background: var(--accent); color: #fff;
  }
  .btn:hover { background: var(--accent-hover); }
  .btn.ghost { background: transparent; border-color: var(--border); color: var(--text); }
  .btn.ghost:hover { background: var(--bg-hover); }
  .btn.ghost.active { border-color: var(--accent); color: var(--accent); }
  .btn.danger { background: transparent; border-color: var(--red); color: var(--red); }
  .btn.danger:hover { background: rgba(239,68,68,.12); }
  .btn.sm { padding: 4px 10px; font-size: 12px; }
  .btn:disabled { opacity: .5; cursor: not-allowed; }
  /* ---------- Forms ---------- */
  label.f { display: block; font-size: 12.5px; color: var(--text-dim); margin: 12px 0 4px; }
  input[type=text], input[type=password], input[type=number], select, textarea {
    width: 100%;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 7px;
    color: var(--text);
    padding: 8px 10px;
    font-size: 13px;
    font-family: inherit;
  }
  input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); }
  input.mono-input, textarea.mono-input { font-family: var(--mono); font-size: 12px; }
  .form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
  .checkbox-row { display: flex; align-items: center; gap: 8px; margin-top: 14px; font-size: 13px; }
  /* ---------- Modal (native <dialog>: Esc + Fokus-Falle + Top-Layer) ---------- */
  dialog.modal {
    margin: auto; /* UA-Zentrierung: der Global-Reset (* { margin: 0 }) killt sie — ohne das hängt das Modal oben links (Thema S) */
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 0; /* Padding liegt auf .modal-inner — Backdrop-Close ist exakt e.target === dialog (Thema AA: native Select-Dropdowns feuern Klicks außerhalb des Rects) */
    width: 560px; max-width: 92vw; max-height: 88vh;
    overflow-y: auto;
    color: var(--text);
  }
  .modal-inner { padding: 24px 26px; }
  dialog.modal::backdrop { background: rgba(0,0,0,.6); }
  .modal.modal-wide {
    width: 1120px; max-width: 94vw;
  }
  /* modal-tall (Thema AC): nahezu Vollhöhe — nur ein kleiner Rand
     oben/unten. Kombinierbar mit modal-wide (Preis-Popup). */
  .modal.modal-tall {
    max-height: calc(100vh - 16px);
  }
  .modal h2 { font-size: 17px; margin-bottom: 6px; }
  .modal .actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 22px; }
  /* ---------- Add-Provider wizard ---------- */
  .wiz-progress { display: flex; align-items: center; gap: 8px; margin: 12px 0 2px; }
  .wiz-dot {
    width: 24px; height: 24px; border-radius: 50%;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 12px; font-weight: 600;
    border: 1px solid var(--border); color: var(--text-dim);
    flex: 0 0 auto;
  }
  .wiz-dot.active { background: var(--accent); border-color: var(--accent); color: #fff; }
  .wiz-dot.done { border-color: var(--accent); color: var(--accent); }
  .wiz-step-label { font-size: 12.5px; color: var(--text-dim); margin-left: 6px; }
  .wiz-hint { color: var(--text-dim); font-size: 12px; margin-top: 10px; }
  /* ---------- Misc ---------- */
  .empty { color: var(--text-dim); text-align: center; padding: 40px 0; font-size: 13.5px; }
  .spinner {
    display: inline-block;
    width: 18px; height: 18px;
    border: 2px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin .8s linear infinite;
  }
  @keyframes spin { to { transform: rotate(360deg); } }
  .loading { display: flex; align-items: center; gap: 10px; color: var(--text-dim); padding: 30px 0; justify-content: center; }
  #toast-wrap { position: fixed; bottom: 22px; right: 22px; z-index: 200; display: flex; flex-direction: column; gap: 8px; }
  .toast {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-left: 3px solid var(--accent);
    border-radius: 8px;
    padding: 11px 16px;
    font-size: 13px;
    max-width: 420px;
    box-shadow: 0 6px 24px rgba(0,0,0,.4);
  }
  .toast.error { border-left-color: var(--red); }
  .toast.success { border-left-color: var(--green); }
  .toast.warning { border-left-color: var(--yellow); }
  pre.json, pre.body-view {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 12px;
    font-family: var(--mono);
    font-size: 11.5px;
    overflow-x: auto;
    white-space: pre-wrap;
    word-break: break-all;
    max-height: 320px;
    overflow-y: auto;
  }
  /* ---------- Observability Trajectory view ----------
     Structural replica of the Deepseek Harness Trajectory ledger:
     a vertical row table (index · kind tag · text · metrics · time) with a
     record inspector on the right that shows context-sensitive detail tabs.
     Mirrors TrajectoryCell.module.css / TrajectoryTable.module.css. */
  .obs-detail-toggle { display: flex; gap: 6px; margin: 12px 0 8px; }
  .obs-detail-toggle .btn.sm.active { background: var(--accent); color: #fff; border-color: var(--accent); }
  .obs-body-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 10px; }
  .obs-truncated { color: var(--yellow); font-size: 11.5px; margin-top: 4px; }
  .obs-raw-json { display: none; }
  .obs-raw-json.visible { display: block; }
  .obs-structured { display: none; }
  .obs-structured.visible { display: block; }
  /* Split container: trajectory table pane left, record inspector right. */
  .traj-split { display: block; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; background: var(--bg); margin-top: 4px; }
  /* Detail sits BELOW the selected row, slightly indented, full width. */
  .traj-detail-row td { height: auto; padding: 8px 8px 10px 28px; border-bottom: 1px solid var(--border); background: var(--bg-hover); white-space: normal; overflow: visible; }
  .traj-detail-row .traj-details { width: auto; max-height: none; border-left: none; border-top: none; }
  .traj-table-pane { flex: 1; min-width: 0; overflow-x: hidden; overflow-y: auto; max-height: 480px; }
  /* Row ledger — 30px rows, fixed columns: event (index+tag) · content · trailing metrics. */
  .traj-table { width: 100%; min-width: 0; border-collapse: separate; border-spacing: 0; table-layout: fixed; color: var(--text); font-size: 12px; }
  .traj-table col.traj-col-event { width: 128px; }
  .traj-table col.traj-col-trailing { width: 336px; }
  .traj-table td { box-sizing: border-box; height: 30px; padding: 0 8px; overflow: hidden; border-bottom: 1px solid var(--border); text-overflow: ellipsis; white-space: nowrap; vertical-align: middle; font-size: 12px; }
  .traj-table tbody tr { cursor: pointer; transition: background-color .12s ease; }
  .traj-table tbody tr:hover { background: var(--bg-hover); }
  .traj-table tbody tr[data-selected="true"] { background: var(--bg-hover); box-shadow: inset 3px 0 0 var(--accent); }
  .traj-table tbody tr[data-error="true"] { box-shadow: inset 3px 0 0 var(--red); }
  .traj-table tbody tr[data-error="true"] .traj-content { color: var(--red); }
  .traj-event { padding-left: 12px !important; }
  .traj-table tbody tr[data-kind="subtool"] .traj-event { padding-left: 24px !important; }
  .traj-event-inner { display: flex; align-items: center; gap: 10px; }
  .traj-index { flex: none; width: 26px; color: var(--text-dim); font-family: var(--mono); font-size: 11px; }
  .traj-kind-slot { flex: none; width: 76px; display: flex; align-items: center; justify-content: flex-end; }
  /* Kind tag — 19px badge, 10px uppercase label, one color per kind. */
  .traj-tag { display: inline-flex; align-items: center; box-sizing: border-box; height: 19px; padding: 0 5px; border: 1px solid transparent; border-radius: 4px; font-size: 10px; line-height: 16px; font-weight: 650; letter-spacing: .035em; user-select: none; white-space: nowrap; }
  .traj-tag-system { color: var(--text-dim); background: var(--bg-hover); }
  .traj-tag-user { color: #7cb3ff; background: rgba(59,130,246,.16); }
  .traj-tag-context { color: #4ade80; background: rgba(34,197,94,.14); }
  .traj-tag-message { color: #a89bff; background: rgba(139,124,255,.14); }
  .traj-tag-thinking { color: #67e8f9; background: rgba(6,182,212,.14); }
  .traj-tag-tool { color: #fbbf24; background: rgba(245,158,11,.14); }
  .traj-tag-subtool { color: #d9a83b; background: rgba(245,158,11,.08); }
  .traj-content { color: var(--text); }
  .traj-tool-call-only { color: var(--text-dim); }
  .traj-tool-name { color: var(--text); font-family: var(--mono); font-size: 12px; }
  .traj-tool-args { margin-left: 7px; color: var(--text-dim); font-family: var(--mono); font-size: 12px; }
  .traj-inline-result { color: var(--text-dim); }
  .traj-inline-result.err { color: var(--red); }
  .traj-inline-result .traj-arrow { margin: 0 8px; opacity: .6; }
  /* Trailing metrics: 4 x 71px columns (input · output · think · time), 12px
     gaps, right-aligned — same geometry as TrajectoryCell's .trailing. */
  .traj-trailing { text-align: right; }
  .traj-metric, .traj-time { display: inline-block; width: 71px; text-align: left; color: var(--text-dim); font-family: var(--mono); font-size: 11.5px; white-space: nowrap; }
  .traj-metric + .traj-metric, .traj-metric + .traj-time { margin-left: 12px; }
  /* Record inspector (detail panel). */
  .traj-details { display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--bg); }
  .traj-details-header { display: flex; flex: none; align-items: center; justify-content: space-between; box-sizing: border-box; height: 42px; padding: 0 8px 0 12px; border-bottom: 1px solid var(--border); }
  .traj-details-title { display: flex; align-items: center; min-width: 0; gap: 8px; }
  .traj-details-location { min-width: 0; overflow: hidden; color: var(--text-dim); font-family: var(--mono); font-size: 11px; line-height: 16px; text-overflow: ellipsis; white-space: nowrap; }
  .traj-details-close { display: inline-flex; flex: none; align-items: center; justify-content: center; width: 28px; height: 28px; padding: 0; border: 0; border-radius: 6px; color: var(--text-dim); background: transparent; cursor: pointer; font-size: 18px; line-height: 18px; }
  .traj-details-close:hover { color: var(--text); background: var(--bg-hover); }
  .traj-detail-tabs { display: flex; flex: none; box-sizing: border-box; width: 100%; height: 34px; padding: 0 8px; overflow-x: auto; overflow-y: hidden; gap: 1px; border-bottom: 1px solid var(--border); scrollbar-width: none; white-space: nowrap; }
  .traj-detail-tabs::-webkit-scrollbar { display: none; }
  .traj-detail-tab { position: relative; flex: none; padding: 0 9px; border: 0; color: var(--text-dim); background: transparent; cursor: pointer; font-size: 12.5px; }
  .traj-detail-tab:hover { color: var(--text); background: var(--bg-hover); }
  .traj-detail-tab.active { color: var(--accent); }
  .traj-detail-tab.active::after { content: ''; position: absolute; left: 9px; right: 9px; bottom: 0; height: 2px; border-radius: 1px 1px 0 0; background: var(--accent); }
  .traj-detail-body { flex: 1; min-height: 0; overflow-x: hidden; overflow-y: auto; }
  /* Overview definition list (Status / Tokens / Timing rows). */
  .traj-overview { margin: 0; padding: 8px 0; font-size: 12.5px; }
  .traj-overview > div { display: grid; grid-template-columns: 110px minmax(0, 1fr); min-height: 22px; padding: 0 14px; align-items: center; }
  .traj-overview > div.sub dt { padding-left: 12px; }
  .traj-overview dt { color: var(--text-dim); }
  .traj-overview dd { margin: 0; min-width: 0; overflow: hidden; color: var(--text); text-overflow: ellipsis; white-space: nowrap; }
  .traj-overview dd.err { color: var(--red); }
  /* Overview sections with click-through headings that open the full tab. */
  .traj-ov-section { border-top: 1px solid var(--border); padding-bottom: 8px; }
  .traj-ov-heading { display: flex; align-items: flex-end; box-sizing: border-box; width: 100%; height: 28px; margin: 0; padding: 0 0 3px 14px; color: var(--text-dim); font-size: 12px; font-weight: 600; user-select: none; }
  .traj-ov-title { display: inline-flex; align-items: center; gap: 3px; padding: 0; border: 0; color: inherit; background: transparent; cursor: pointer; font: inherit; user-select: none; }
  .traj-ov-title:hover { color: var(--text); }
  .traj-chev { display: inline-block; font-size: 9px; opacity: .6; transition: transform .12s ease; }
  .traj-ov-preview { max-height: 160px; overflow: auto; }
  /* Payload / markdown / thinking bodies. */
  .traj-payload { box-sizing: border-box; margin: 0; padding: 14px; overflow-wrap: anywhere; color: var(--text); font-family: var(--mono); font-size: 12px; line-height: 19px; tab-size: 2; white-space: pre-wrap; }
  .traj-payload.preview { padding: 6px 14px 8px; }
  .traj-payload.err { color: var(--red); }
  .traj-md { padding: 10px 14px; color: var(--text); font-size: 12.5px; line-height: 1.55; white-space: pre-wrap; overflow-wrap: anywhere; }
  .traj-md.preview { padding: 6px 14px 8px; }
  .traj-no-payload { margin: 0; padding: 18px 14px; color: var(--text-dim); font-size: 12.5px; }
  .traj-thinking { margin: 6px 14px 0 12px; padding-left: 6px; border-left: 2px solid var(--accent); color: var(--text-dim); }
  .traj-thinking-toggle { display: flex; align-items: center; gap: 3px; width: max-content; height: 18px; padding: 0; border: 0; color: var(--text-dim); background: transparent; cursor: pointer; font-size: 12px; font-weight: 600; user-select: none; }
  .traj-thinking-toggle:hover { color: var(--text); }
  .traj-thinking-toggle .traj-chev { opacity: 1; }
  .traj-thinking-body { padding: 4px 0 6px; font-size: 12.5px; white-space: pre-wrap; overflow-wrap: anywhere; }
  /* Assistant tool-call list inside the message preview. */
  .traj-asst-calls { margin: 8px 14px; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 4px; }
  .traj-asst-call-btn { display: flex; align-items: center; gap: 6px; width: 100%; min-width: 0; padding: 5px 8px; border: 1px solid var(--border); border-radius: 6px; background: var(--bg-card); color: var(--text); cursor: pointer; font-size: 12px; text-align: left; }
  .traj-asst-call-btn:hover { background: var(--bg-hover); }
  .traj-asst-call-name { flex: none; font-family: var(--mono); color: var(--text); }
  .traj-asst-call-args { min-width: 0; overflow: hidden; font-family: var(--mono); color: var(--text-dim); text-overflow: ellipsis; white-space: nowrap; }
  /* Tool catalog (system row "Tools" tab). */
  .traj-tool-catalog { min-height: 100%; padding: 8px 0 16px; }
  .traj-tool-catalog-item { border-bottom: 1px solid var(--border); }
  .traj-tool-catalog-summary { display: grid; grid-template-columns: 12px 14px max-content minmax(0, 1fr); align-items: center; box-sizing: border-box; min-height: 30px; padding: 4px 12px; gap: 5px; cursor: pointer; list-style: none; user-select: none; }
  .traj-tool-catalog-summary::-webkit-details-marker { display: none; }
  .traj-tool-catalog-summary:hover { background: var(--bg-hover); }
  .traj-tool-catalog-item[open] .traj-chev { transform: rotate(90deg); }
  .traj-tool-glyph { font-size: 11px; }
  .traj-tool-catalog-name { color: var(--text); font-family: var(--mono); font-size: 12px; font-weight: 500; }
  .traj-tool-catalog-desc { min-width: 0; overflow: hidden; color: var(--text-dim); font-size: 12.5px; text-overflow: ellipsis; white-space: nowrap; }
  .traj-tool-catalog-def { padding: 0 0 8px 29px; }
  .traj-tool-catalog-fulldesc { margin: 0; padding: 7px 14px 4px 0; color: var(--text-dim); font-size: 12.5px; white-space: pre-wrap; }
  /* Tool schema (tool row "Schema" tab). */
  .traj-schema { min-height: 100%; padding-top: 10px; }
  .traj-schema-name { margin: 0; padding: 0 14px; color: var(--text); font-family: var(--mono); font-size: 12px; font-weight: 600; }
  .traj-schema-desc { margin: 2px 0 0; padding: 0 14px; color: var(--text-dim); font-size: 12.5px; white-space: pre-wrap; }
  .traj-schema-params-title { margin: 0; padding: 8px 14px 2px; color: var(--text-dim); font-size: 11px; font-weight: 600; user-select: none; }
  .expand-row td { background: var(--bg); }
  /* The expand row's colspan cell must not influence column widths: with
     auto table layout the browser distributes a spanning cell's intrinsic
     width over ALL spanned columns, which squeezed/shifted every column
     when a detail row was opened. contain:inline-size zeroes the intrinsic
     width contribution; the detail content then lays out at the cell's
     actual width and the table keeps its closed-state geometry. */
  .obs-detail-inner { contain: inline-size; overflow-x: auto; }
  .chart-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: 10px; padding: 16px 18px; margin-bottom: 16px; }
  .chart-card h3 { font-size: 13.5px; font-weight: 600; margin-bottom: 10px; color: var(--text-dim); }
  canvas.chart { width: 100%; height: 220px; display: block; }
  .toolbar { display: flex; gap: 10px; align-items: center; margin-bottom: 14px; flex-wrap: wrap; }
  .toolbar select, .toolbar input { width: auto; }
  .group-head { display: flex; align-items: center; justify-content: space-between; }
  .visibility-select { width: 110px; padding: 4px 8px; font-size: 12.5px; }
  .th-sort { cursor: pointer; user-select: none; white-space: nowrap; }
  .th-sort:hover { color: var(--accent); }
  .th-sort .sort-arrow { font-size: 10px; color: var(--accent); }
  .modelle-filter { display: flex; gap: 10px; align-items: center; margin-bottom: 12px; flex-wrap: wrap; }
  .modelle-filter input[type="text"], .modelle-filter select { width: auto; padding: 5px 8px; font-size: 12.5px; }
  .modelle-filter label { display: flex; gap: 5px; align-items: center; font-size: 12.5px; color: var(--text-dim); }
  .provider-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(390px, 1fr)); gap: 14px; }
  /* Auto-refresh indicator: flashing dot while polling is active. */
  .arf-dot {
    display: inline-block; width: 10px; height: 10px; border-radius: 50%;
    background: var(--green); animation: arf-blink 1.2s ease-in-out infinite;
  }
  @keyframes arf-blink { 0%, 100% { opacity: 1; } 50% { opacity: .15; } }
  .provider-category { margin: 20px 0 10px; font-size: 13px; font-weight: 600; color: var(--text-dim); text-transform: uppercase; letter-spacing: .06em; border-bottom: 1px solid var(--border); padding-bottom: 4px; }
  .provider-category:first-child { margin-top: 0; }
  .kv { display: grid; grid-template-columns: 130px 1fr; gap: 4px 12px; font-size: 12.5px; margin-top: 10px; }
  .kv dt { color: var(--text-dim); }
  .kv dd { font-family: var(--mono); font-size: 12px; word-break: break-all; }
  details.json-details { margin-top: 10px; }
  details.json-details summary { cursor: pointer; color: var(--text-dim); font-size: 12.5px; }
  details.json-details summary:hover { color: var(--text); }
  .secret-display { display: flex; gap: 8px; align-items: center; margin-top: 10px; }
  .secret-display code {
    flex: 1; background: var(--bg); border: 1px solid var(--yellow);
    border-radius: 7px; padding: 10px; font-family: var(--mono); font-size: 13px;
    color: var(--yellow); word-break: break-all;
  }
  /* ---------- Fuzzy autocomplete ---------- */
  .fuzzy-wrap { position: relative; }
  .fuzzy-list {
    position: absolute; top: 100%; left: 0; right: 0; z-index: 130;
    background: var(--bg-card); border: 1px solid var(--border); border-radius: 7px;
    margin-top: 4px; max-height: 260px; overflow-y: auto;
    box-shadow: 0 8px 24px rgba(0,0,0,.45);
    display: none;
  }
  .fuzzy-item { padding: 7px 10px; font-size: 12.5px; font-family: var(--mono); cursor: pointer; }
  .fuzzy-item:hover, .fuzzy-item.active { background: var(--bg-hover); }
  .fuzzy-item mark { background: rgba(59,130,246,.35); color: var(--text); border-radius: 2px; padding: 0 1px; }
  .fuzzy-empty { padding: 7px 10px; font-size: 12px; color: var(--text-dim); }
  /* ---------- Chips (multi-select) ---------- */
  .chips { display: flex; flex-wrap: wrap; gap: 5px; margin: 4px 0 6px; }
  .chip {
    display: inline-flex; align-items: center; gap: 6px;
    background: rgba(59,130,246,.15); color: var(--accent);
    border-radius: 999px; padding: 2px 10px;
    font-size: 12px; font-family: var(--mono);
  }
  .chip .x { cursor: pointer; font-weight: 700; }
  .chip .x:hover { color: var(--red); }
  .chip-toggle { cursor: pointer; user-select: none; background: var(--bg); color: var(--text-dim); border: 1px solid var(--border); }
  .chip-toggle.selected { background: rgba(59,130,246,.18); color: var(--accent); border-color: var(--accent); }
  /* ---------- Usage progress bar ---------- */
  .usage-bar { background: var(--border); border-radius: 4px; height: 6px; margin: 4px 0 2px; overflow: hidden; position: relative; }
  .usage-bar > div { height: 100%; }
  .usage-bar-marker { position: absolute; top: 0; bottom: 0; width: 2px; background: rgba(255,255,255,0.7); z-index: 1; }
  /* ---------- Kimi apiv2 ---------- */
  .kimi-apiv2 { margin-top: 10px; padding-top: 8px; border-top: 1px dashed var(--border); }
  .kimi-apiv2-title { font-size: 12px; font-weight: 600; color: var(--text-dim); margin-bottom: 6px; }
  .kimi-login-tabs { display: flex; gap: 6px; margin: 12px 0 6px; border-bottom: 1px solid var(--border); padding-bottom: 10px; flex-wrap: wrap; }
  .kimi-login-tab { background: transparent; border: 1px solid var(--border); color: var(--text-dim); border-radius: 7px; padding: 5px 12px; font-size: 12.5px; font-weight: 600; cursor: pointer; }
  .kimi-login-tab:hover { background: var(--bg-hover); }
  .kimi-login-tab.active { background: var(--accent); border-color: var(--accent); color: #fff; }
  .kimi-qr-box { background: #fff; padding: 10px; border-radius: 8px; display: inline-block; line-height: 0; }
  /* ---------- Sidebar toggle (collapsible navigation) ---------- */
  .sidebar-open-btn {
    display: none;
    position: fixed; top: 10px; left: 10px; z-index: 170;
    background: var(--bg-panel); border: 1px solid var(--border);
    color: var(--text); border-radius: 7px; padding: 6px 11px;
    font-size: 16px; line-height: 1.2; cursor: pointer;
    box-shadow: 0 4px 14px rgba(0,0,0,.35);
  }
  .sidebar-open-btn:hover { background: var(--bg-hover); }
  .sidebar-close-btn {
    background: transparent; border: 1px solid var(--border); color: var(--text-dim);
    border-radius: 6px; padding: 2px 8px; font-size: 13px; cursor: pointer; flex-shrink: 0;
  }
  .sidebar-close-btn:hover { background: var(--bg-hover); color: var(--text); }
  /* Wide screens: the sidebar can be collapsed via the toggle buttons. */
  @media (min-width: 901px) {
    body.sb-collapsed .sidebar { display: none; }
    body.sb-collapsed .sidebar-open-btn { display: block; }
  }
  /* Narrow screens: the sidebar becomes an overlay drawer, closed by default. */
  @media (max-width: 900px) {
    .sidebar {
      position: fixed; left: 0; top: 0; z-index: 165;
      height: 100vh; width: 250px;
      transform: translateX(-105%);
      transition: transform .2s ease;
      box-shadow: 0 0 48px rgba(0,0,0,.55);
    }
    body.sb-open .sidebar { transform: none; }
    .sidebar-open-btn { display: block; }
    body.sb-open .sidebar-open-btn { display: none; }
    main { padding: 56px 16px 24px; }
  }
