/*
  Prism brand layer (brand kit v1.1). Loaded after every other stylesheet so
  the brand shape wins over module defaults: pill buttons and switches, 2px
  fields and badges, square panels without shadows, mono uppercase labels,
  JetBrains Mono numbers, always-dark code blocks.
*/

body { font-family: var(--font-sans); font-size: 14px; line-height: 1.5; font-weight: 400; }
.mono, code, kbd, .badge-count, .log-time, .log-source, .picker-tail, .popover-tail, .key-index, .cfg-no, .scope-pill, .chip-btn, .input-badge { font-family: var(--font-mono); font-variant-ligatures: none; }
.code-block pre, .raw-log { font-family: var(--font-mono); font-variant-ligatures: normal; }
:focus-visible { outline: 2px solid var(--orange); outline-offset: 2px; }
a { color: var(--text-primary); text-decoration: underline; text-decoration-color: var(--orange); text-decoration-thickness: 0.12em; text-underline-offset: 0.18em; }
a:hover { color: var(--text-primary); text-decoration-color: var(--text-primary); }


/* Метки: моно 500 11px капс 0.2em */
.section-rule, .nav-group-label, .data-table th, .popover-label, .page-head-meta, .hero-card-label, .hero-cost-label, .model-grid .grid-head {
  font-family: var(--font-mono); font-weight: 500; font-size: 11px; letter-spacing: 0.2em; text-transform: uppercase; color: var(--stone); font-variant-ligatures: none;
}
[data-theme="dark"] .section-rule, [data-theme="dark"] .nav-group-label, [data-theme="dark"] .data-table th, [data-theme="dark"] .popover-label,
[data-theme="dark"] .page-head-meta, [data-theme="dark"] .hero-card-label, [data-theme="dark"] .hero-cost-label, [data-theme="dark"] .model-grid .grid-head { color: var(--text-tertiary); }
.section-rule .rule-bar { width: 2px; height: 14px; background: var(--orange); }
.section-rule .rule-num { color: var(--text-primary); }
.section-rule .rule-sep { color: var(--stone); }

/* Заголовки */
.page-title { font-family: var(--font-sans); font-size: 28px; font-weight: 600; line-height: 1.25; letter-spacing: -0.01em; }
.page-title::after { content: "."; color: var(--orange); }
.page-subtitle { font-size: 14px; line-height: 1.5; color: var(--text-tertiary); margin-top: 6px; }
.section-title { font-size: 20px; font-weight: 600; line-height: 1.3; letter-spacing: 0; }
.section-lead { font-size: 14px; }
.card-title { font-size: 16px; font-weight: 600; letter-spacing: 0; }
.card-sub, .record-meta, .form-hint, .demo-note, .stat-card .stat-label { font-size: 13px; color: var(--text-tertiary); }
.dialog h2 { font-size: 20px; font-weight: 600; line-height: 1.3; }

/* Числа — JetBrains Mono */
.stat-card .stat-value, .budget-card .budget-value, .hero-number, .hero-cost-value, .num, .legend-total {
  font-family: var(--font-mono); font-variant-ligatures: none; font-variant-numeric: tabular-nums; letter-spacing: -0.02em; font-weight: 500;
}
.stat-card .stat-value { font-size: 26px; }
.stat-card .stat-note, .budget-card .budget-note, .hero-card-note, .hero-cost-note { font-size: 12px; color: var(--text-tertiary); }

/* Панели: прямые углы, тонкие линии, без теней */
.card, .stat-card, .budget-card, .subcard, .filters, .table-wrap, .model-grid, .cfg-group, .key-row, .quick-link, .code-block, .dashed-empty, .warn-panel, .error-panel, .store-card, .save-bar, .dialog, .popover, .skeleton { border-radius: 0; }
.cfg-group, .key-row, .quick-link { border-color: var(--line); }
[data-theme="dark"] .cfg-group, [data-theme="dark"] .key-row, [data-theme="dark"] .quick-link { border-color: var(--border-color); }
.featured-card { background: var(--bg-card); border-color: var(--border-color); border-top: 2px solid var(--orange); }

/* Кнопки — полностью скруглённые */
.btn { border-radius: var(--radius-pill); padding: 8px 16px; font-weight: 600; font-size: 13px; border: 1px solid var(--border-color); background: transparent; color: var(--text-primary); }
.btn:hover:not(:disabled) { background: var(--bg-hover); border-color: var(--border-hover); }
.btn-sm { padding: 6px 12px; font-size: 12.5px; }
.btn-lg { padding: 11px 20px; font-size: 14px; }
.btn-primary { background: var(--orange); border-color: var(--orange); color: var(--white); font-weight: 700; }
.btn-primary:hover:not(:disabled) { background: var(--primary-hover); border-color: var(--primary-hover); color: var(--white); }
.btn-ink { background: var(--ink-btn-bg); border-color: var(--ink-btn-bg); color: var(--ink-btn-text); }
.btn-ink:hover:not(:disabled) { opacity: 1; background: var(--graphite); border-color: var(--graphite); color: var(--white); }
[data-theme="dark"] .btn-ink:hover:not(:disabled) { background: #D6D2CE; border-color: #D6D2CE; color: var(--ink); }
.btn-danger { background: rgba(255, 107, 107, 0.18); border-color: transparent; color: var(--text-primary); }
.btn-danger:hover:not(:disabled) { background: var(--coral); border-color: var(--coral); color: var(--ink); }
.btn.active { border-color: var(--orange); color: var(--text-primary); background: var(--ui-accent-soft); }
.icon-btn { border-radius: var(--radius-pill); background: transparent; }
.icon-btn.danger { color: var(--text-primary); border-color: rgba(255, 107, 107, 0.5); }
.icon-btn.danger:hover { background: rgba(255, 107, 107, 0.18); }
.btn-link { font-weight: 600; color: var(--text-primary); }
.btn-link svg { color: var(--orange); }
.topbar-link { border-radius: var(--radius-pill); }
.topbar-link.active { color: var(--text-primary); }

/* Переключатели — скруглённые, активный оранжевый с белым */
.tabs, .segmented, .sidebar-theme-selector { border-radius: var(--radius-pill); background: var(--bg-tertiary); border: 1px solid var(--border-color); padding: 3px; }
.tabs button, .segmented button, .sidebar-theme-selector button { border-radius: var(--radius-pill); font-weight: 600; color: var(--text-tertiary); border: 0; }
.tabs button.active, .segmented button.active, .sidebar-theme-selector button.active { background: var(--orange); color: var(--white); font-weight: 700; box-shadow: none; }
.tabs button:hover:not(.active), .segmented button:hover:not(.active), .sidebar-theme-selector button:hover:not(.active) { color: var(--text-primary); }
.switch { background: var(--border-hover); }
.switch[aria-checked="true"] { background: var(--orange); }
.chip { border-radius: var(--radius-pill); }
.chip-btn.active { background: var(--orange); border-color: var(--orange); color: var(--white); font-weight: 700; }
.default-pick { border-radius: var(--radius-pill); }
.default-pick.on { background: var(--orange); border-color: var(--orange); color: var(--white); font-weight: 700; }
.default-pick.light.on { background: var(--ui-accent-soft); border-color: var(--orange); color: var(--text-primary); }

/* Поля и метки — 2px */
.input, .select { border-radius: 2px; border-color: var(--border-color); font-size: 13.5px; padding: 9px 11px; }
.input:focus, .select:focus { border-color: var(--orange); outline: 2px solid var(--orange); outline-offset: 1px; box-shadow: none; }
.url-box { border-radius: 2px; }
.url-box .mono { color: var(--text-primary); }
.badge, .scope-pill, .tag, .key-index, .cfg-no, .input-badge, .avatar, .provider-mark, .step-num, .store-mark { border-radius: 2px; }
.badge { font-weight: 600; font-size: 12px; background: transparent; }
.badge-success { background: var(--success-badge-bg); color: var(--success-badge-text); border-color: transparent; }
.badge-error { background: var(--failure-badge-bg); color: var(--failure-badge-text); border-color: transparent; }
.badge-error .dot, .badge-error::before { background: var(--coral); }
.badge-warning { background: var(--warning-badge-bg); color: var(--amber-text); border-color: transparent; }
.badge-enterprise { background: var(--orange); color: var(--primary-contrast); border-color: transparent; }
.dot-on { background: var(--live); }
[data-theme="dark"] .dot-on { background: var(--emerald); }
.dot-warn { background: var(--amber); }
.dot-off { background: var(--border-hover); }

/* Таблицы: числа справа */
.data-table th { background: transparent; }
.data-table th.num, .data-table td.num { text-align: end; }
.model-grid { background: transparent; }
.model-grid .data-table th { background: transparent; }


/* Данные */
.log-level.warn { color: var(--text-primary); }
.log-level.warn::before, .log-level.error::before { content: ""; display: inline-block; width: 6px; height: 6px; margin-inline-end: 6px; border-radius: 50%; vertical-align: 1px; }
.log-level.warn::before { background: var(--amber); }
.log-level.error { color: var(--text-primary); }
.log-level.error::before { background: var(--coral); }
.log-level { font-family: var(--font-mono); font-weight: 500; }

/* Код — всегда тёмный */
.code-block { background: var(--ink); border-color: var(--ink); }
.code-block pre { color: #D6D2CE; font-size: 13px; line-height: 1.65; }
.code-block .icon-btn { color: #D6D2CE; border-color: #4A4643; }
[data-theme="dark"] .code-block { background: #151312; border-color: #2E2B29; }

/* Уведомления и панели */
.notice { border-radius: 0; border-inline-start: 2px solid var(--orange); }
.notice.error { border-inline-start-color: var(--coral); }
.notice.warn { border-inline-start-color: var(--amber); }
.notice.neutral { border-inline-start-color: var(--stone); }
.warn-panel { background: var(--warning-badge-bg); border: 0; border-inline-start: 2px solid var(--amber); color: var(--text-primary); }
.error-panel { background: var(--failure-badge-bg); border: 0; border-inline-start: 2px solid var(--coral); color: var(--text-primary); }
.save-bar { border-color: var(--border-color); border-top: 2px solid var(--orange); }

.tabs { flex-wrap: nowrap; max-width: 100%; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.page > .tabs { max-width: calc(100% - 2 * clamp(16px, 2.6vw, 32px)); }
.tabs::-webkit-scrollbar { display: none; }
.sidebar-theme-selector button { font-size: 11px; padding: 5px 0; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.chip, .segmented button, .tabs button { white-space: nowrap; }

/* Модули: те же правила формы для собственных классов страниц */
.version-popover, .bucket-tip, .chain-row, .quota-policy, .quota-account, .quota-calendar-scroll, .quota-empty, .quota-error,
.qt-card, .qt-menu-list, .qt-menu-list button, .pool-account, .media-preview, .media-transcript, .media-error, .media-empty { border-radius: 0; }
.brand-mark, .demo-chip, .quota-status, .quota-filters button > span, .quota-lane-summary > span, .account-open, .qt-out,
.changelog-notes code, .changelog-intro code, .skill-meta code, .quota-sort select { border-radius: 2px; }
.qt-now-label { border-radius: 2px 2px 0 0; }
.quota-segment, .quota-segment button, .qt-seg, .qt-seg button, .qt-btn, .qt-refresh-all, .media-tabs, .media-tabs button { border-radius: var(--radius-pill); }
.save-bar { box-shadow: none; }
.bucket-tip, .qt-menu-list { box-shadow: var(--ui-panel-shadow); }
.quota-segment, .qt-seg, .media-tabs { background: var(--bg-tertiary); border: 1px solid var(--border-color); padding: 3px; }
.quota-segment button, .qt-seg button, .media-tabs button { font-weight: 600; color: var(--text-tertiary); }
.quota-segment button[aria-pressed=true], .qt-seg button[aria-pressed="true"], .media-tabs button.active { background: var(--orange); color: var(--white); font-weight: 700; box-shadow: none; }
.quota-filters button[aria-pressed=true] { border-bottom-color: var(--orange); }
.media-tabs button.active span { color: var(--white); }

/* Логотип */
.sidebar-brand { display: block; padding: 8px 8px 18px; text-decoration: none; }
.brand-lockup { display: block; width: 114px; height: auto; }
.brand-lockup.on-dark { display: none; }
[data-theme="dark"] .brand-lockup.on-light { display: none; }
[data-theme="dark"] .brand-lockup.on-dark { display: block; }

/* Герой «Обзора»: знак, слоган, активность за час */
.hero-tagline { margin: 0 0 18px; font-family: var(--font-display); font-weight: 400; font-size: 13px; letter-spacing: 0.04em; color: var(--text-tertiary); }

/* Знак на главном экране — волна света по граням и вращение */
.hero-mark { position: relative; display: block; width: 112px; height: 112px; margin: 0 0 22px; padding: 0; border: 0; background: none; cursor: pointer; }
.hero-mark img { display: block; width: 100%; height: 100%; }
.hero-mark .on-dark { display: none; }
[data-theme="dark"] .hero-mark .on-light { display: none; }
[data-theme="dark"] .hero-mark .on-dark { display: block; }
.hero-mark .mark-svg { display: block; width: 100%; height: 100%; }
.hero-mark .mark-svg svg { display: block; width: 100%; height: 100%; overflow: visible; }
.hero-mark .mark-svg.on-dark { display: none; }
[data-theme="dark"] .hero-mark .mark-svg.on-light { display: none; }
[data-theme="dark"] .hero-mark .mark-svg.on-dark { display: block; }
.hero-mark polygon { animation: prism-fire 5s ease-in-out infinite; }
[data-theme="dark"] .hero-mark polygon { animation-name: prism-fire-dark; }
@keyframes prism-fire { 0%, 34%, 100% { stroke-width: var(--sw); } 14% { stroke-width: calc(var(--sw) * 2.1); stroke-opacity: 1; } }
@keyframes prism-fire-dark { 0%, 34%, 100% { stroke-width: var(--sw); } 14% { stroke-width: calc(var(--sw) * 1.7); stroke-opacity: 1; filter: brightness(1.35); } }
.hero-mark .mark-svg svg { animation: prism-spin 192s linear infinite; transform-origin: 50% 50%; }
@keyframes prism-spin { to { transform: rotate(360deg); } }
.hero-mark.paused polygon, .hero-mark.paused .mark-svg svg { animation-play-state: paused; }
.hero-mark:focus-visible { outline-offset: 4px; }
@media (prefers-reduced-motion: reduce) { .hero-mark .mark-svg svg, .hero-mark polygon { animation: none; } }

/* Навигация: подложка Tint, оранжевая риска слева, текст Ink */
.nav-section button { position: relative; border-radius: 0; font-size: 13.5px; font-weight: 500; color: var(--text-secondary); padding: 7px 10px; }
.nav-section button.active, [data-theme="dark"] .nav-section button.active { background: var(--ui-accent-soft); color: var(--text-primary); font-weight: 600; }
.nav-section button.active::before { content: ""; position: absolute; left: 0; top: 6px; bottom: 6px; width: 2px; background: var(--orange); }
.nav-section button.active svg { color: var(--orange); opacity: 1; }
.nav-group-label { font-size: 10.5px; padding: 8px 10px 5px; }
.sidebar-search, .sidebar-contact, .scope-trigger, .sidebar-menu-toggle { border-radius: 2px; }
.picker-item { border-radius: 0; position: relative; }
.picker-item.active, [data-theme="dark"] .picker-item.active { background: var(--ui-accent-soft); }
.picker-item.active::before { content: ""; position: absolute; left: 0; top: 7px; bottom: 7px; width: 2px; background: var(--orange); }
.picker-item.active .picker-name, [data-theme="dark"] .picker-item.active .picker-name { color: var(--text-primary); font-weight: 600; }
.popover-item { border-radius: 0; }
.popover-item.selected { color: var(--text-primary); font-weight: 600; box-shadow: inset 2px 0 0 var(--orange); }


/* Счётчики в меню */
.nav-count { min-width: 20px; padding: 1px 6px; border-radius: 2px; background: var(--bg-tertiary); font-family: var(--font-mono); font-variant-ligatures: none; font-size: 11px; font-weight: 500; line-height: 16px; text-align: center; color: var(--text-secondary); }
.nav-section button.active .nav-count { background: var(--bg-card); color: var(--text-primary); }

/* Графики и полосы. Одна метрика — Prism Orange; серии — Electric Blue,
   Emerald, персиковый. Столбики затухают к оси: маска на всю высоту области
   графика, от непрозрачного сверху до 0.12 у оси, одна на все серии. */
.bucket-stack { -webkit-mask-image: linear-gradient(to bottom, #000 0%, rgba(0, 0, 0, 0.12) 100%); mask-image: linear-gradient(to bottom, #000 0%, rgba(0, 0, 0, 0.12) 100%); }
.bucket-ok, .bucket-fail, .bucket-subscription { border-radius: 0; }
.bucket-ok { background: var(--orange); }
.bucket-fail { background: var(--series-2); }
.bucket-subscription { background: var(--series-4); }
.bucket:hover .bucket-ok, .bucket:focus-visible .bucket-ok { background: var(--primary-hover); }
.bucket:focus-visible { border-radius: 0; }
.legend-cash, .legend-failed, .legend-subscription { border-radius: 0; }
.legend-cash { background: var(--orange); }
.legend-failed { background: var(--series-2); }
.legend-subscription { background: var(--series-4); }
.swatch, .legend-item i { border-radius: 0; }
.swatch.ok { background: var(--orange); }
.swatch.fail { background: var(--series-2); }

/* Прогресс: обычный — оранжевый, близко к лимиту — Amber, превышен — Coral */
.bar-track, .quota-meter, .qt-meter { border-radius: 0; height: 4px; }
.bar-fill, .quota-meter > span, .qt-meter > i { border-radius: 0; }
.bar-fill { background: var(--orange); }
.bar-fill.warn { background: var(--amber); }
.bar-fill.over { background: var(--coral); }

/* Кнопка в процессе: спиннер вместо иконки, бегущая полоса снизу */
.btn.is-busy, .btn:has(> .spinner) { position: relative; overflow: hidden; cursor: progress; opacity: 1; }
.btn.is-busy:disabled, .btn:has(> .spinner):disabled { opacity: 1; cursor: progress; }
.btn.is-busy > svg, .btn:has(> .spinner) > svg { display: none; }
.btn.is-busy::after, .btn:has(> .spinner)::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 2px;
  background: linear-gradient(90deg, transparent 0, var(--orange) 40%, var(--orange) 60%, transparent 100%);
  background-size: 40% 100%; background-repeat: no-repeat;
  animation: btn-progress 1.1s ease-in-out infinite;
}
.btn-primary.is-busy::after, .btn-primary:has(> .spinner)::after,
.btn-ink.is-busy::after, .btn-ink:has(> .spinner)::after { background-image: linear-gradient(90deg, transparent 0, rgba(255, 255, 255, 0.9) 40%, rgba(255, 255, 255, 0.9) 60%, transparent 100%); }
@keyframes btn-progress { from { background-position: -60% 0; } to { background-position: 160% 0; } }
.btn .spinner { width: 12px; height: 12px; border-width: 1.6px; animation-duration: 0.7s; animation-timing-function: linear; }
@media (prefers-reduced-motion: reduce) {
  .btn.is-busy::after, .btn:has(> .spinner)::after { animation: none; background: var(--orange); opacity: 0.5; }
  .spinner { animation-duration: 2s; }
}

/* Уведомление под кнопкой после завершения процесса */
.notice.btn-notice {
  position: fixed; z-index: 90; display: inline-flex; align-items: center; gap: 8px; min-width: 0;
  max-width: min(440px, calc(100vw - 24px)); width: max-content;
  padding: 8px 12px; background: var(--bg-card); border: 1px solid var(--border-color); border-radius: 2px;
  box-shadow: var(--ui-panel-shadow); font-size: 13px; font-weight: 600; color: var(--text-primary);
  animation: btn-notice-in 0.18s ease-out;
}
.notice.btn-notice::before { content: ""; position: absolute; top: -5px; left: var(--arrow, 16px); width: 8px; height: 8px; background: var(--bg-card); border-inline-start: 1px solid var(--border-color); border-top: 1px solid var(--border-color); transform: rotate(45deg); }
.notice.btn-notice > i { width: 7px; height: 7px; border-radius: 50%; flex: none; background: var(--live); }
[data-theme="dark"] .notice.btn-notice > i { background: var(--emerald); }
.notice.btn-notice.warn > i { background: var(--amber); }
.notice.btn-notice.error > i { background: var(--coral); }
.notice.btn-notice.neutral > i { background: var(--text-tertiary); }
.notice.btn-notice[data-side="above"]::before { top: auto; bottom: -5px; transform: rotate(225deg); }
.notice.btn-notice[data-side="end"]::before { top: calc(50% - 4px); left: -5px; transform: rotate(-45deg); }
.notice.btn-notice[data-side="start"]::before { top: calc(50% - 4px); left: auto; right: -5px; transform: rotate(135deg); }
/* No free spot beside the button: the notice is a line in the page flow. */
.notice.in-flow { position: static; width: max-content; max-width: 100%; margin: 0 0 12px; box-shadow: none; }
.notice.btn-notice.in-flow { display: inline-flex; margin: 4px 8px; max-width: calc(100% - 16px); vertical-align: middle; }
.notice.btn-notice.in-flow::before { display: none; }
.notice.btn-notice.out { opacity: 0; transform: translateY(-3px); transition: opacity 0.3s, transform 0.3s; }
@keyframes btn-notice-in { from { opacity: 0; transform: translateY(-4px); } }
@media (prefers-reduced-motion: reduce) { .notice.btn-notice { animation: none; } .notice.btn-notice.out { transition: none; } }

/* Глобальный поиск */
.cmd-backdrop { position: fixed; inset: 0; z-index: 95; display: flex; justify-content: center; align-items: flex-start; padding: 12vh 16px 16px; background: rgba(29, 27, 26, 0.32); }
[data-theme="dark"] .cmd-backdrop { background: rgba(0, 0, 0, 0.6); }
.cmd { width: min(680px, 100%); max-height: 72vh; display: flex; flex-direction: column; background: var(--bg-card); border: 1px solid var(--border-color); box-shadow: 0 24px 60px -20px rgba(29, 27, 26, 0.35); animation: cmd-in .14s ease-out; }
@keyframes cmd-in { from { opacity: 0; transform: translateY(-6px); } }
.cmd-input-row { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--border-color); color: var(--text-tertiary); }
.cmd-input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; font-size: 16px; font-weight: 500; color: var(--text-primary); }
.cmd-input:focus-visible { outline: 0; }
.cmd-input::placeholder { color: var(--text-tertiary); font-weight: 400; }
.cmd-scope-pill { flex: none; padding: 3px 8px; border-radius: 2px; background: var(--ui-accent-soft); box-shadow: inset 2px 0 0 var(--orange); font-size: 12px; font-weight: 600; color: var(--text-primary); }
.cmd-scope-pill[hidden] { display: none; }
.cmd-kbd, .cmd-foot kbd { font-family: var(--font-mono); font-size: 10.5px; font-weight: 500; padding: 2px 6px; border: 1px solid var(--border-color); border-radius: 2px; color: var(--text-tertiary); background: var(--bg-quinary); }
.cmd-scopes { display: flex; gap: 6px; padding: 10px 16px; border-bottom: 1px solid var(--border-color); overflow-x: auto; scrollbar-width: none; }
.cmd-scope { flex: none; display: inline-flex; align-items: center; gap: 6px; padding: 5px 11px; border: 1px solid var(--border-color); border-radius: 999px; background: transparent; font-size: 12.5px; font-weight: 600; color: var(--text-secondary); white-space: nowrap; }
.cmd-scope .mono { font-size: 11px; color: var(--text-tertiary); }
.cmd-scope:hover { border-color: var(--border-hover); color: var(--text-primary); }
.cmd-scope.active { background: var(--orange); border-color: var(--orange); color: var(--white); font-weight: 700; }
.cmd-scope.active .mono { color: var(--white); }
.cmd-note { padding: 8px 16px; font-size: 12.5px; color: var(--text-secondary); background: var(--bg-quinary); border-bottom: 1px solid var(--border-color); }
.cmd-list { position: relative; flex: 1; overflow-y: auto; padding: 4px 0 8px; }
.cmd-group { padding: 12px 16px 6px; font-family: var(--font-mono); font-size: 11px; font-weight: 500; letter-spacing: .2em; text-transform: uppercase; color: var(--text-tertiary); }
.cmd-item { position: relative; display: flex; align-items: center; gap: 12px; width: 100%; padding: 9px 16px; border: 0; background: transparent; text-align: start; color: var(--text-primary); }
.cmd-item.sel { background: var(--ui-accent-soft); }
.cmd-item.sel::before { content: ""; position: absolute; left: 0; top: 6px; bottom: 6px; width: 2px; background: var(--orange); }
.cmd-ic { flex: none; display: grid; place-items: center; width: 22px; height: 22px; color: var(--text-tertiary); }
.cmd-item.sel .cmd-ic { color: var(--orange); }
.cmd-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.cmd-title { font-size: 14px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cmd-title.mono { font-size: 13px; font-weight: 500; }
.cmd-hint { font-size: 12.5px; color: var(--text-tertiary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cmd-item mark { background: none; color: inherit; text-decoration: underline; text-decoration-color: var(--orange); text-decoration-thickness: 2px; text-underline-offset: 3px; }
.cmd-kind { flex: none; font-family: var(--font-mono); font-size: 10.5px; letter-spacing: .12em; text-transform: uppercase; color: var(--text-tertiary); }
.cmd-enter { flex: none; width: 22px; text-align: center; font-family: var(--font-mono); font-size: 13px; color: var(--text-tertiary); opacity: 0; }
.cmd-item.sel .cmd-enter { opacity: 1; }
.cmd-empty { display: flex; flex-direction: column; gap: 6px; padding: 34px 24px; text-align: center; font-size: 13px; color: var(--text-tertiary); }
.cmd-empty strong { font-size: 15px; color: var(--text-primary); }
.cmd-foot { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; padding: 10px 16px; border-top: 1px solid var(--border-color); font-size: 12px; color: var(--text-tertiary); }
.cmd-foot span { display: inline-flex; align-items: center; gap: 4px; }
.cmd-org { margin-inline-start: auto; font-weight: 600; color: var(--text-secondary); }
@media (prefers-reduced-motion: reduce) { .cmd { animation: none; } }
@media (max-width: 640px) { .cmd-foot span:nth-child(3), .cmd-foot span:nth-child(4) { display: none; } .cmd-backdrop { padding-top: 16px; } }
.cmd-input-row, .cmd-scopes, .cmd-note-slot, .cmd-foot { flex: none; }

/* Предпросмотр запроса: статусы на токенах бренда */
.request-preview-stages strong { color: var(--success-color); }
.request-preview-stale { border-inline-start: 2px solid var(--amber); background: var(--warning-badge-bg); color: var(--text-primary); }

/* Подписки на «Обзоре»: одна строка под карточками расходов */
/* width:0 + min-width:100%: the line takes the cards' width and never widens the column */
.hero-subscriptions { width: 0; min-width: 100%; margin-top: 14px; }
.hero-subscriptions-line { margin: 0; font-size: 12.5px; line-height: 1.6; color: var(--text-secondary); }
.hero-subscriptions-line .hero-card-label { display: block; margin-bottom: 4px; }
.hero-subscriptions-line .btn-link { margin-inline-start: 10px; font-size: 12.5px; }
.subscriptions-dialog { width: min(980px, calc(100vw - 32px)); max-width: 980px; }
.subscription-table td { vertical-align: top; }
.subscription-edit { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.subscription-edit .select { min-width: 200px; }
.subscription-edit .input { width: 150px; }
.subscription-table .num { text-align: start; }

/* Провайдеры ИИ: список провайдеров — выпадашка с поиском в заголовке карточки.
   Кнопка выглядит кнопкой постоянно, а не только под курсором: рамка и
   подложка стоят в спокойном состоянии. Прозрачный заголовок со стрелкой
   читали как заголовок карточки, и список провайдеров за ним не находили. */
.provider-layout { display: block; }
.provider-combo { position: relative; flex: none; }
.provider-combo .card-title { margin: 0; }
.provider-combo-trigger { display: inline-flex; align-items: center; gap: 10px; padding: 6px 12px 6px 8px; border: 1px solid var(--border-primary); border-radius: var(--radius-pill); background: var(--bg-tertiary); color: var(--text-primary); font: inherit; font-weight: 600; cursor: pointer; }
.provider-combo-trigger:hover, .provider-combo.open .provider-combo-trigger { border-color: var(--border-hover); background: var(--bg-primary); }
.provider-combo-trigger:focus-visible { outline: 3px solid var(--ui-focus-ring); outline-offset: 1px; }
.provider-combo-trigger > svg:last-child { color: var(--text-secondary); transition: transform 0.15s; }
.provider-combo.open .provider-combo-trigger > svg:last-child { transform: rotate(180deg); }
.provider-combo-name { white-space: nowrap; }
@media (max-width: 640px) { .provider-combo-name { white-space: normal; text-align: start; } }
.provider-combo-pop { position: absolute; z-index: 40; top: calc(100% + 6px); left: 0; width: min(440px, calc(100vw - 32px)); padding: 8px; display: flex; flex-direction: column; gap: 8px; }
.provider-combo-pop[hidden] { display: none; }
.provider-combo-pop .search-box { width: 100%; }
.provider-combo-pop .picker-list { max-height: min(60vh, 520px); overflow-y: auto; }
.provider-combo-pop .picker-item[hidden] { display: none; }
.provider-combo-empty { padding: 8px 10px; margin: 0; }

/* Подключить провайдера: поле выбора из встроенных провайдеров и каталога
   models.dev. Тот же список с поиском, что у выбора провайдера на странице;
   панель раскрывается в потоке формы, а не поверх неё, потому что диалог сам
   прокручивается. */
.provider-connect-field { margin-bottom: 14px; }
.provider-connect-picker { display: flex; flex-direction: column; gap: 6px; }
.provider-connect-trigger { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 44px; padding: 7px 10px; border: 1px solid var(--border-primary); border-radius: var(--radius-sm); background: var(--bg-primary); color: var(--text-primary); font: inherit; text-align: left; cursor: pointer; }
.provider-connect-trigger:hover { border-color: var(--border-hover); }
.provider-connect-trigger:focus-visible, .provider-connect-trigger[aria-expanded="true"] { border-color: var(--ui-accent); outline: 3px solid var(--ui-focus-ring); outline-offset: -1px; }
.provider-connect-trigger:disabled { opacity: 0.55; cursor: not-allowed; }
.provider-connect-trigger > svg:last-child { margin-left: auto; flex: none; color: var(--text-tertiary); transition: transform 0.15s; }
.provider-connect-trigger[aria-expanded="true"] > svg:last-child { transform: rotate(180deg); }
.provider-connect-picker .picker-text { display: flex; flex-direction: column; min-width: 0; }
.provider-connect-picker .picker-name, .provider-connect-picker .picker-note { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* Why a provider cannot be connected is read in full, also on a phone. */
.provider-connect-picker .picker-item[aria-disabled="true"] .picker-note { white-space: normal; overflow-wrap: anywhere; }
.provider-connect-trigger .picker-name { font-weight: 500; font-size: 12.5px; }
.provider-connect-trigger .picker-note { font-size: 11.5px; color: var(--text-quaternary); }
.provider-connect-panel { display: flex; flex-direction: column; gap: 8px; padding: 8px; background: var(--bg-card); border: 1px solid var(--border-color); border-radius: var(--radius-md); box-shadow: var(--ui-panel-shadow); }
.provider-connect-panel[hidden] { display: none; }
.provider-connect-panel .search-box { width: 100%; max-width: none; }
.provider-connect-panel .picker-list { max-height: min(42vh, 320px); overflow-y: auto; overscroll-behavior: contain; }
.provider-connect-panel .picker-group[hidden], .provider-connect-panel .picker-item[hidden] { display: none; }
.provider-connect-panel .popover-label { position: sticky; top: 0; z-index: 1; background: var(--bg-card); }
.provider-connect-panel .picker-item.focused { background: var(--bg-hover); }
.provider-connect-panel .picker-item[aria-selected="true"] { background: var(--ui-accent-soft); }
.provider-connect-panel .picker-item[aria-selected="true"] .picker-name { color: var(--ui-accent-strong); }
[data-theme="dark"] .provider-connect-panel .picker-item[aria-selected="true"] .picker-name { color: var(--ui-accent); }
.provider-connect-panel .picker-item[aria-disabled="true"] { opacity: 0.5; cursor: not-allowed; }
.provider-connect-panel .picker-item .picker-tail { color: var(--ui-accent); }
.provider-connect-empty { padding: 8px 10px; margin: 0; }

/* Провайдеры ИИ: разделы страницы вкладками */
.page > .api-tabs { margin-bottom: 16px; }
.page > [hidden] { display: none !important; }

/* Hebrew shell and menus follow RTL. Code and time-series geometry remain LTR. */
[dir="rtl"] .search-box svg { left: auto; right: 10px; }
[dir="rtl"] .select-wrap::after { right: auto; left: 11px; transform: translateY(-70%) rotate(-45deg); }
[dir="rtl"] .input-badge { right: auto; left: 8px; }
[dir="rtl"] .dialog-dismiss { right: auto; left: 14px; }
[dir="rtl"] .notice-portal { right: auto; left: 20px; }
[dir="rtl"] .popover-down, [dir="rtl"] .provider-combo-pop { left: auto; right: 0; }
[dir="rtl"] .popover-right { right: auto; left: 0; }
[dir="rtl"] .popover-up { left: 0; right: 0; }
[dir="rtl"] .version-popover { left: auto; right: calc(clamp(200px, 17vw, 232px) + 4px); }
[dir="rtl"] .nav-section button.active::before,
[dir="rtl"] .picker-item.active::before,
[dir="rtl"] .cmd-item.sel::before { left: auto; right: 0; }
[dir="rtl"] .popover-item.selected { box-shadow: inset -2px 0 0 var(--orange); }
[dir="rtl"] .switch::after { left: auto; right: 2px; }
[dir="rtl"] .switch[aria-checked="true"]::after { transform: translateX(-16px); }
[dir="rtl"] .split-rail > :first-child::after { right: auto; left: -14px; }
[dir="rtl"] .quota-meter > i { left: auto; right: 98%; }
[dir="rtl"] :is(pre, code, kbd, .code-block, .runtime-secret, .runtime-policy,
  .input.mono, input[type="email"], input[type="url"], input[type="password"], input[type="number"],
  .chart-frame, .chart-axis, .bucket-chart, .trend-chart) { direction: ltr; unicode-bidi: isolate; }
[dir="rtl"] :is(pre, code, .code-block, .runtime-secret, .runtime-policy, .input.mono,
  input[type="email"], input[type="url"], input[type="password"], input[type="number"]) { text-align: left; }
[dir="rtl"] .bucket-tip { direction: rtl; }
@media (max-width: 860px) {
  [dir="rtl"] .version-popover { left: 12px; right: 12px; }
}
/* The live-region copy of a notice shown in the page flow. */
.notice.sr-only { position: absolute; width: 1px; height: 1px; min-width: 0; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; box-shadow: none; animation: none; }
