/* Local rules - use only when no shared class fits.
 * Colors come from sc-extension-theme.css variables - they auto-invert in dark mode. */

/* Status pill */
.tts-status-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 5px 14px;
    border: 1px solid var(--border-color);
    border-radius: 999px;
    background: var(--bg-input);
    font-size: 13px;
    line-height: 1;
    white-space: nowrap;
    box-shadow: var(--shadow);
}
.tts-status-label   { font-weight: 600; color: var(--text-primary); }
.tts-status-meta    { color: var(--text-muted); }
.tts-status-sep     { display: inline-block; width: 4px; height: 4px;
                      border-radius: 50%; background: var(--text-muted); }
.tts-status-dot--ok      { color: var(--accent-success); font-size: 14px; }
.tts-status-dot--warming { color: var(--accent-warning); font-size: 14px; }
.tts-status-dot--idle    { color: var(--text-muted);     font-size: 14px; }
.tts-status-dot--down    { color: var(--accent-danger);  font-size: 14px; }

/* Header brand */
.tts-brand {
    display: flex;
    align-items: center;
    height: 64px;
    padding-left: 16px;
    gap: 12px;
}
.tts-brand-logo { height: 36px; width: 36px; flex: 0 0 36px; }
.tts-brand-text { display: flex; flex-direction: column; line-height: 1.1; }
.tts-brand-product {
    font-size: 19px;
    font-weight: 700;
    color: var(--accent-success);
    letter-spacing: 0.2px;
}
.tts-brand-owner {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 2px;
    letter-spacing: 0.3px;
}


/* Sidebar */
.tts-menu-icon {
    display: inline-block;
    width: 24px;
    text-align: center;
    margin-right: 12px;
    color: var(--text-muted);
    font-size: 18px;
    vertical-align: middle;
    transition: color 0.15s ease;
}
.tts-menu-label {
    vertical-align: middle;
    font-size: 14px;
    color: var(--text-primary);
    transition: color 0.15s ease;
}
/* Sidebar selected + hover. Bright green left-edge accent bar (via
 * ::before to bypass any container overflow), bright green icon, bold
 * label. !important on color is required because shared theme has
 * `.webix_selected span { color: inherit !important }`. */
.tts-sidebar-list .webix_list_item { position: relative; }
.tts-sidebar-list .webix_list_item::before {
    content: "";
    position: absolute;
    left: 0; top: 0; bottom: 0;
    width: 6px;
    background: transparent;
    transition: background 0.15s ease;
}
.tts-sidebar-list .webix_list_item:hover::before,
.tts-sidebar-list .webix_list_item.webix_selected::before {
    background: var(--sc-primary);
}
.tts-sidebar-list .webix_list_item:hover .tts-menu-icon,
.tts-sidebar-list .webix_list_item.webix_selected .tts-menu-icon {
    color: var(--sc-primary) !important;
}
.tts-sidebar-list .webix_list_item:hover .tts-menu-label,
.tts-sidebar-list .webix_list_item.webix_selected .tts-menu-label {
    color: var(--accent-success) !important;
    font-weight: 600;
}

/* Typography — h1/h2/h4 come from sc-extension-theme.css element styles.
 * The .tts-h1/-h2/-h4 classes remain on JS-rendered markup as no-ops.
 *
 * h3 is overridden locally: theme's 20px is too loud for the in-page
 * subsection density of TTS docs/admin views. Font (PT Sans) and color
 * inherit from the theme's `h1, h2, h3, h4` rule. */
.tts-h3 {
    font-size: 16px;
    line-height: 1.3;
    margin: 0px;
}
.tts-lead {
    font-size: 16px;
    line-height: 1.55;
    margin: 0 0 16px 0;
    color: var(--text-primary);
    max-width: 820px;
}
.tts-body {
    font-size: 14px;
    line-height: 1.6;
    margin: 0 0 12px 0;
    color: var(--text-primary);
    max-width: 820px;
}
.tts-bullets {
    margin: 8px 0 16px 18px;
    padding: 0;
    line-height: 1.7;
    font-size: 14px;
    color: var(--text-primary);
}

/* Muted helper text: footnotes, status lines, "Loading…", inline meta
 * under demo audio (audio · file size · latency · request id). */
.tts-fineprint,
.tts-meta {
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.4;
}
.tts-meta code {
    font-family: var(--font-mono, 'Roboto Mono', monospace);
    font-size: 11.5px;
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    padding: 1px 6px;
    border-radius: 3px;
}

/* Generic HTML tables (Benchmarks, Tech Stack, Monitor, API keys, Eval).
 * NOT Webix datatable - Webix has its own rules in the shared theme. */
.tts-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    color: var(--text-primary);
}
.tts-table th,
.tts-table td {
    padding: 6px 10px;
    text-align: left;
    vertical-align: middle;
}
.tts-table thead th {
    font-weight: 600;
    color: var(--text-secondary);
    border-bottom: 2px solid var(--border-color);
}
.tts-table tbody tr + tr td {
    border-top: 1px solid var(--border-color);
}

/* Home metric cards */
.tts-metric-card {
    padding: 16px 18px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-secondary);
    margin-right: 12px;
}
.tts-metric-label {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    color: var(--text-muted);
    margin-bottom: 6px;
}
.tts-metric-value {
    font-size: 26px;
    font-weight: 700;
    color: var(--accent-success);
    line-height: 1.1;
    margin-bottom: 6px;
}
.tts-metric-unit {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-muted);
    margin-left: 4px;
}
.tts-metric-hint {
    font-size: 12px;
    line-height: 1.4;
    color: var(--text-muted);
}

/* Home CTAs - equal-weight clickable cards.
 *
 * Markup (rendered by ctaCard() in tts-page.js):
 *   .tts-cta[.tts-cta--accent]            ← outer Webix view (css prop)
 *     .tts-cta-card                       ← inner clickable card
 *       .tts-cta-icon                     ← circular icon slot (left)
 *       .tts-cta-body                     ← text column (middle, grows)
 *         .tts-cta-title
 *         .tts-cta-subtitle
 *       .tts-cta-arrow                    ← chevron indicator (right)
 */
.tts-cta-card {
    display: flex;
    align-items: center;
    gap: 14px;
    cursor: pointer;
    box-sizing: border-box;
    height: 100%;
    padding: 16px 18px;
    border: 1.5px solid var(--border-color);
    border-radius: 10px;
    background: var(--bg-secondary);
    transition: transform 0.15s ease, box-shadow 0.15s ease,
                border-color 0.15s ease, background 0.15s ease;
}
.tts-cta-card:hover {
    transform: translateY(-2px);
    border-color: var(--accent-success);
    background: var(--bg-input);
    box-shadow: var(--shadow);
}
.tts-cta-card:active { transform: translateY(0); }

.tts-cta-icon {
    flex: 0 0 40px;
    width: 40px; height: 40px;
    display: inline-flex; align-items: center; justify-content: center;
    border-radius: 50%;
    background: var(--bg-tertiary);
    color: var(--accent-success);
    font-size: 22px;
}
.tts-cta-card:hover .tts-cta-icon {
    background: color-mix(in srgb, var(--sc-primary) 25%, transparent);
}
.tts-cta-body {
    flex: 1 1 auto;
    min-width: 0;
    display: flex; flex-direction: column;
    line-height: 1.25;
}
.tts-cta-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
}
.tts-cta-subtitle {
    margin-top: 4px;
    font-size: 12.5px;
    color: var(--text-muted);
    line-height: 1.35;
}
.tts-cta-arrow {
    flex: 0 0 auto;
    color: var(--text-muted);
    font-size: 18px;
    transition: transform 0.15s ease, color 0.15s ease;
}
.tts-cta-card:hover .tts-cta-arrow {
    color: var(--accent-success);
    transform: translateX(3px);
}

/* Pulse on the recommended CTA (.tts-cta--accent on the outer Webix view).
 * Animation lives on the inner card so the green ring hugs the visible edge. */
@keyframes tts-cta-pulse {
    0%, 70%, 100% { box-shadow: 0 0 0 0 rgba(111, 212, 47, 0); }
    35%           { box-shadow: 0 0 0 8px rgba(111, 212, 47, 0.35); }
}
.tts-cta--accent .tts-cta-card {
    animation: tts-cta-pulse 3.5s ease-out infinite;
}
.tts-cta--accent .tts-cta-card:hover { animation: none; }
@media (prefers-reduced-motion: reduce) {
    .tts-cta--accent .tts-cta-card { animation: none; }
    .tts-cta-card { transition: none; }
}

/* Tech Stack permanent sections */
.tts-stack-section {
    margin-bottom: 16px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-input);
    overflow: hidden;
}
.tts-stack-header {
    display: flex;
    align-items: center;
    padding: 10px 16px;
    background: var(--bg-tertiary);
    border-bottom: 1px solid var(--border-color);
}
.tts-stack-icon {
    color: var(--accent-success);
    font-size: 18px;
    margin-right: 10px;
}
.tts-stack-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-primary);
}
.tts-stack-list {
    margin: 0;
    padding: 12px 18px 14px 36px;
    line-height: 1.7;
    font-size: 14px;
    color: var(--text-primary);
}
.tts-stack-list li { margin: 2px 0; }

/* Demo view */
.tts-form-section {
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    margin: 16px 0 8px 0;
}
.tts-form-helper {
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.4;
    padding: 14px 0 0 12px;
}
.tts-rec-stage {
    margin: 12px;
    padding: 18px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    border: 1.5px solid var(--border-color);
    border-radius: 10px;
    background: var(--bg-input);
    transition: border-color 0.15s, box-shadow 0.15s;
}
.tts-rec-stage--active {
    border-color: var(--accent-danger);
    box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent-danger) 8%, transparent);
}
.tts-rec-timer {
    font-family: 'Roboto Mono', monospace;
    font-size: 14px;
    color: var(--text-primary);
    margin-left: 8px;
}
.tts-rec-note {
    width: 100%;
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 4px;
}
.tts-btn-disabled { opacity: 0.5; cursor: not-allowed; }

/* Recording - tape-recorder buttons (Record / Stop) */
.tts-rec-btn {
    cursor: pointer;
    padding: 12px 22px;
    margin-right: 12px;
    font-size: 15px;
    font-weight: 600;
    border-radius: 6px;
    border: 1.5px solid var(--border-color);
    background: var(--bg-input);
    color: var(--text-primary);
    transition: background 0.15s, border-color 0.15s, transform 0.05s;
}
.tts-rec-btn:hover:not(:disabled) {
    border-color: var(--accent-success);
    background: var(--bg-tertiary);
}
.tts-rec-btn:active:not(:disabled) { transform: translateY(1px); }
.tts-rec-btn:disabled { opacity: 0.45; cursor: not-allowed; }
.tts-rec-btn .sci {
    font-size: 22px;
    vertical-align: -4px;
    margin-right: 4px;
}
.tts-rec-btn--record .sci { color: var(--accent-danger); }
.tts-rec-btn--stop   .sci { color: var(--text-primary); }
.tts-rec-stage--active .tts-rec-btn--record .sci {
    animation: tts-rec-blink 1s ease-in-out infinite;
}
.tts-rec-stage--active .tts-rec-timer {
    color: var(--accent-danger); font-weight: 600;
    animation: tts-rec-blink 1s ease-in-out infinite;
}
@keyframes tts-rec-blink { 50% { opacity: 0.4; } }

/* Loading + result rendering.
 * Spinner itself comes from shared theme `.sc-loading-spinner`.
 * `.tts-loading` is the inline row wrapper (spinner + label). */
.tts-loading {
    display: flex; align-items: center; gap: 12px;
    padding: 24px;
    color: var(--text-primary);
}
.tts-loading-text { font-size: 14px; }

/* Output panel: outer Webix view frame wrapping demo/synth output. */
.tts-output-frame {
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-input);
}
.tts-demo-empty {
    padding: 28px;
    text-align: center;
    font-style: italic;
    color: var(--text-muted);
    font-size: 14px;
}
.tts-demo-result {
    padding: 14px 16px;
}

.tts-transcript-text {
    padding: 18px;
    font-size: 16px;
    line-height: 1.6;
    color: var(--text-primary);
    white-space: pre-wrap;
}
.tts-result-error {
    padding: 18px;
    border-left: 4px solid var(--accent-danger);
    background: var(--error-bg);
    border-radius: 4px;
    margin: 6px;
}
.tts-result-error-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--accent-danger);
    margin-bottom: 4px;
}
.tts-result-error-title .sci { margin-right: 6px; }
.tts-result-error-fix {
    font-size: 13px;
    color: var(--text-primary);
    line-height: 1.5;
}

/* API reference */
.tts-api-meta {
    display: grid;
    grid-template-columns: repeat(2, max-content);
    gap: 4px 24px;
    margin: 12px 0 16px 0;
    font-size: 14px;
    color: var(--text-primary);
}
.tts-openapi-frame {
    width: 100%;
    height: 100%;
    min-height: 720px;
    border: 0;
    background: var(--bg-input);
}

/* Dark-theme contrast for selected scsegmented option. */
[data-theme="dark"] .webix_all_segments .webix_selected {
    background: var(--accent-primary);
    color: var(--accent-button-text);
    border-color: var(--accent-primary);
}

/* Mermaid diagram host (Architecture page). Class is applied as Webix
 * `css:` on the sctemplate view; the rendered SVG fills the box.
 *
 * No min-height / no overflow:auto - the sctemplate has autoheight:true
 * and the SVG carries its own height. After mermaid finishes rendering,
 * renderMermaidInto() calls wxView.resize() so Webix re-measures and the
 * wrapper grows to the SVG's natural height (no scrollbars / no clip). */
.tts-diagram {
    width: 100%;
    padding: 0px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: 8px;
}
.tts-diagram svg {
    display: block;
    margin: 0 auto;
    max-width: 100%;
    height: auto;
}
.tts-diagram-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 60px 20px;
    color: var(--text-muted);
}
.tts-diagram-loading .sc-loading-spinner { margin: 0; }

/* FSM cheat-sheet (How it works) */
.tts-fsm {
    padding: 14px 18px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-secondary);
}
.tts-fsm-row {
    display: flex; align-items: center; flex-wrap: wrap;
    gap: 8px; row-gap: 12px;
    font-size: 13px;
}
.tts-fsm-node {
    padding: 6px 14px;
    border-radius: 999px;
    border: 1.5px solid var(--border-color);
    background: var(--bg-input);
    font-weight: 600;
    color: var(--text-primary);
    text-transform: lowercase;
    transition: background 0.15s, border-color 0.15s;
}
.tts-fsm-node.tts-fsm-start { border-color: var(--sc-secondary); }
.tts-fsm-node.tts-fsm-end   { border-color: var(--accent-success); background: var(--bg-tertiary); }
.tts-fsm[data-state="recording"] .tts-fsm-node.tts-fsm-start,
.tts-fsm[data-state="uploading"] .tts-fsm-node {
    background: var(--bg-tertiary);
    border-color: var(--accent-success);
}
.tts-fsm-arrow {
    color: var(--text-muted);
    font-family: monospace;
    letter-spacing: -1px;
    user-select: none;
}
.tts-fsm-branch {
    display: flex; flex-direction: column; gap: 4px;
    padding: 0 4px;
}
.tts-fsm-edge {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 4px 10px;
    border: 1px dashed var(--sc-secondary);
    border-radius: 6px;
    background: var(--bg-input);
    color: var(--text-primary);
    font-size: 12.5px;
    white-space: nowrap;
}
.tts-fsm-edge.tts-fsm-or {
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-weight: 700;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1px;
    justify-content: center;
    padding: 0;
}
.tts-fsm-edge .tts-fsm-mic { color: var(--accent-danger); }
.tts-fsm-edge .tts-fsm-file { color: var(--accent-success); }
.tts-fsm-hint {
    margin-top: 10px;
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.5;
}
@media (prefers-reduced-motion: reduce) {
    .tts-rec-stage--active .tts-rec-timer { animation: none; }
}

/* ============================================================
 * TTS-specific: disabled "teaser" sidebar items
 * (auth-gated views show greyed-out until API key is set)
 * ============================================================ */
.tts-sidebar-list .webix_list_item.tts-locked .tts-menu-icon,
.tts-sidebar-list .webix_list_item.tts-locked .tts-menu-label {
    color: var(--text-muted) !important;
    opacity: 0.55;
}
.tts-sidebar-list .webix_list_item.tts-locked::after {
    content: "🔒";
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 11px;
    opacity: 0.6;
}
.tts-sidebar-list .webix_list_item.tts-locked:hover {
    cursor: help;
}
.tts-sidebar-list .webix_list_item.tts-locked:hover::before {
    background: var(--accent-warning);
    opacity: 0.5;
}

/* Voice library grid (rows of cards) */
.tts-voice-card {
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 14px 16px;
    margin-bottom: 10px;
    display: grid;
    grid-template-columns: 1fr 220px;
    gap: 12px;
    align-items: center;
    transition: border-color 0.1s ease, box-shadow 0.1s ease;
    cursor: pointer;
}
.tts-voice-card:hover {
    border-color: var(--sc-primary);
    box-shadow: var(--shadow);
}
.tts-voice-card.selected {
    border-color: var(--sc-primary);
    background: var(--selected-bg);
}
.tts-voice-name {
    font-weight: 700;
    font-size: 14px;
    color: var(--text-primary);
}
.tts-voice-meta {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 4px;
}
.tts-voice-transcript {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 6px;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
}
.tts-voice-actions {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    justify-content: flex-end;
}
.tts-lang-badge {
    display: inline-block;
    padding: 1px 8px;
    border-radius: 12px;
    font-size: 10px;
    font-family: var(--font-mono, monospace);
    background: var(--bg-input);
    color: var(--text-muted);
    border: 1px solid var(--border-color);
    margin-left: 6px;
    vertical-align: middle;
}
.tts-lang-badge.ru {
    background: color-mix(in srgb, var(--accent-info) 10%, transparent);
    color: var(--accent-info);
    border-color: var(--accent-info);
}
.tts-lang-badge.en {
    background: color-mix(in srgb, var(--accent-success) 10%, transparent);
    color: var(--accent-success);
    border-color: var(--accent-success);
}

/* Diff colors (eval) */
.diff-eq  { color: var(--text-primary); }
.diff-del {
    background: color-mix(in srgb, var(--accent-danger) 12%, transparent);
    color: var(--accent-danger);
    text-decoration: line-through;
    padding: 0 3px;
    border-radius: 3px;
    margin: 0 1px;
}
.diff-ins {
    background: color-mix(in srgb, var(--accent-success) 12%, transparent);
    color: var(--accent-success);
    padding: 0 3px;
    border-radius: 3px;
    margin: 0 1px;
}
.tts-match-pill {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    font-family: var(--font-mono, monospace);
}
.tts-match-pill.high {
    background: color-mix(in srgb, var(--accent-success) 15%, transparent);
    color: var(--accent-success);
}
.tts-match-pill.mid {
    background: color-mix(in srgb, var(--accent-warning) 20%, transparent);
    color: var(--accent-warning);
}
.tts-match-pill.low {
    background: color-mix(in srgb, var(--accent-danger) 15%, transparent);
    color: var(--accent-danger);
}

/* Drop zone for voice clone (and any other file-drop surface on the page) */
.tts-drop-zone {
    border: 2px dashed var(--border-color);
    border-radius: 8px;
    padding: 24px;
    text-align: center;
    color: var(--text-muted);
    background: var(--bg-input);
    transition: border-color 0.15s ease, background 0.15s ease;
    cursor: pointer;
}
.tts-drop-zone:hover, .tts-drop-zone.tts-drop-over {
    border-color: var(--sc-primary);
    background: var(--selected-bg);
    color: var(--accent-success);
}

/* Warning chips */
.tts-warn {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-family: var(--font-mono, monospace);
    background: var(--warning-bg);
    color: var(--accent-warning);
    border: 1px solid color-mix(in srgb, var(--accent-warning) 50%, transparent);
    margin: 0 4px 4px 0;
}
.tts-warn.critical {
    background: var(--error-bg);
    color: var(--accent-danger);
    border-color: color-mix(in srgb, var(--accent-danger) 50%, transparent);
}

/* Voice library — voice card secondary lines */
.tts-voice-counts {
    font-size: 11px;
    color: var(--text-secondary);
    margin-top: 2px;
}
.tts-voice-desc {
    font-size: 12px;
    color: var(--text-secondary);
    margin: 6px 0 12px;
}

/* Tighter tables for samples / presets inside voice detail */
.tts-samples-table th,
.tts-samples-table td,
.tts-presets-table th,
.tts-presets-table td {
    padding: 4px 8px;
    font-size: 12px;
    vertical-align: middle;
}
.tts-samples-table audio,
.tts-presets-table audio {
    max-width: 220px;
}

/* Tiny action buttons inside table rows */
.tts-btn-tiny {
    display: inline-block;
    padding: 2px 8px;
    font-size: 11px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background: var(--bg-secondary);
    cursor: pointer;
    margin-right: 2px;
}
.tts-btn-tiny:hover { background: var(--hover-bg); }
.tts-btn-tiny.tts-btn-primary {
    background: var(--accent-primary);
    color: var(--accent-button-text);
    border-color: transparent;
}
.tts-btn-tiny.tts-btn-danger {
    background: color-mix(in srgb, var(--accent-danger) 10%, transparent);
    color: var(--accent-danger);
    border-color: color-mix(in srgb, var(--accent-danger) 40%, transparent);
}

/* "default" badge on default preset row */
.tts-badge-default {
    display: inline-block;
    padding: 1px 8px;
    border-radius: 10px;
    font-size: 10px;
    background: color-mix(in srgb, var(--sc-primary) 15%, transparent);
    color: var(--accent-success);
    border: 1px solid color-mix(in srgb, var(--sc-primary) 40%, transparent);
}

/* Header user button (single control replacing the old user widget + cog) */
.tts-header-user-cell .webix_template { padding: 0 !important; }
.tts-header-user-btn {
    display: inline-flex; align-items: center; gap: 8px;
    height: 36px; padding: 0 14px;
    margin: 14px 0;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 18px;
    font: inherit; font-size: 13px;
    cursor: pointer;
    transition: background 120ms ease;
}
.tts-header-user-btn:hover { background: var(--hover-bg); }
.tts-header-user-btn .sci { font-size: 18px; line-height: 1; }
.tts-header-user-name {
    max-width: 140px;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    font-weight: 500;
}

/* Popup menu */
.tts-user-menu-head {
    padding: 10px 12px;
    border-bottom: 1px solid var(--border-color);
    font-size: 13px;
}

.tts-pill {
    display: inline-block; padding: 1px 8px; border-radius: 10px;
    font-size: 11px; font-weight: 600; text-transform: uppercase;
    line-height: 16px;
}
.tts-pill-admin { background: var(--accent-danger); color: var(--accent-button-text); }
.tts-pill-user  { background: var(--text-muted);   color: var(--accent-button-text); }

/* Standard page scroll surface — applied by the centered() helper to
 * the page-level scrollview. Header (rows[0]) stays sticky above it.
 * Right padding keeps content off the scrollbar. */
.tts-page-scroll .webix_scroll_cont {
    padding-right: 16px;
    padding-bottom: 24px;
    box-sizing: border-box;
}

/* Monitor page tiles.
 * `css: "tts-monitor-tiles"` lands on the sctemplate's webix_view; the
 * actual tile divs render inside .webix_template, so flex must target
 * the inner element. */
.tts-monitor-tiles .webix_template {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    padding: 12px !important;
    background: transparent !important;
}
.tts-kpi-tile {
    flex: 1 1 0;
    min-width: 180px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 14px 16px;
    background: var(--bg-secondary);
    box-shadow: var(--shadow);
}
.tts-kpi-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    color: var(--text-muted);
}
.tts-kpi-value {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 6px 0 4px;
    line-height: 1.1;
}
.tts-kpi-sub {
    font-size: 12px;
    color: var(--text-muted);
}
.tts-kpi-ok     { border-color: color-mix(in srgb, var(--accent-success) 40%, transparent); }
.tts-kpi-warn   {
    border-color: color-mix(in srgb, var(--accent-warning) 60%, transparent);
    background: var(--warning-bg);
}
.tts-kpi-danger {
    border-color: color-mix(in srgb, var(--accent-danger) 60%, transparent);
    background: var(--error-bg);
}
.tts-monitor-chart {
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 8px;
    margin-top: 8px;
    background: var(--bg-secondary);
}
.tts-monitor-chart canvas { display: block; width: 100%; height: 100%; }

/* Hardcoded F5 runtime table inside preset dialog */
.tts-runtime-table th, .tts-runtime-table td {
    padding: 4px 8px;
    font-size: 12px;
    vertical-align: middle;
    border-bottom: 1px solid var(--border-color);
}
.tts-runtime-table code {
    background: var(--bg-tertiary);
    padding: 1px 4px;
    border-radius: 3px;
}
