@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
    /* Theme variables - Default Sleek Dark */
    --bg-primary: #080C14;
    --bg-secondary: rgba(13, 20, 35, 0.75);
    --border-color: rgba(255, 255, 255, 0.07);
    --text-primary: #F3F4F6;
    --text-secondary: #9CA3AF;
    --text-muted: #6B7280;
    
    --accent-blue: #3B82F6;
    --accent-indigo: #6366F1;
    --accent-purple: #8B5CF6;
    --accent-pink: #EC4899;
    --accent-green: #10B981;
    --accent-red: #EF4444;
    
    --card-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.4);
    --glow-shadow: 0 0 20px rgba(99, 102, 241, 0.15);
    
    --sidebar-bg: rgba(8, 12, 20, 0.45);
    --input-bg: rgba(8, 12, 20, 0.7);
    --input-border: rgba(255, 255, 255, 0.07);
    --card-bg: rgba(255, 255, 255, 0.015);
    --graph-container-bg: rgba(8, 12, 20, 0.4);
    --scrollbar-thumb: rgba(99, 102, 241, 0.3);
    --scrollbar-track: rgba(8, 12, 20, 0.5);
    --body-bg-gradient: radial-gradient(circle at 15% 20%, rgba(99, 102, 241, 0.08) 0%, transparent 40%),
                         radial-gradient(circle at 85% 80%, rgba(236, 72, 153, 0.05) 0%, transparent 40%);
}

/* Premium Light Theme */
body[data-theme="light"] {
    --bg-primary: #F3F4F6;
    --bg-secondary: rgba(255, 255, 255, 0.9);
    --border-color: rgba(0, 0, 0, 0.08);
    --text-primary: #1F2937;
    --text-secondary: #4B5563;
    --text-muted: #6B7280;
    
    --accent-blue: #2563EB;
    --accent-indigo: #4F46E5;
    --accent-purple: #7C3AED;
    --accent-pink: #DB2777;
    --accent-green: #059669;
    --accent-red: #DC2626;
    
    --card-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.06);
    --glow-shadow: 0 0 20px rgba(79, 70, 229, 0.08);
    
    --sidebar-bg: rgba(255, 255, 255, 0.7);
    --input-bg: #FFFFFF;
    --input-border: rgba(0, 0, 0, 0.12);
    --card-bg: rgba(0, 0, 0, 0.015);
    --graph-container-bg: rgba(0, 0, 0, 0.02);
    --scrollbar-thumb: rgba(79, 70, 229, 0.3);
    --scrollbar-track: rgba(0, 0, 0, 0.05);
    --body-bg-gradient: radial-gradient(circle at 15% 20%, rgba(99, 102, 241, 0.04) 0%, transparent 40%),
                         radial-gradient(circle at 85% 80%, rgba(236, 72, 153, 0.02) 0%, transparent 40%);
}

/* Soft Cream Paper Theme */
body[data-theme="cream"] {
    --bg-primary: #F5EFEB;
    --bg-secondary: rgba(253, 251, 247, 0.9);
    --border-color: rgba(67, 56, 44, 0.09);
    --text-primary: #2C241D;
    --text-secondary: #5C4E40;
    --text-muted: #7C6E5E;
    
    --accent-blue: #1D4ED8;
    --accent-indigo: #4338CA;
    --accent-purple: #6D28D9;
    --accent-pink: #BE185D;
    --accent-green: #047857;
    --accent-red: #B91C1C;
    
    --card-shadow: 0 8px 32px 0 rgba(67, 56, 44, 0.05);
    --glow-shadow: 0 0 20px rgba(67, 56, 44, 0.05);
    
    --sidebar-bg: rgba(243, 235, 228, 0.75);
    --input-bg: #FDFBF7;
    --input-border: rgba(67, 56, 44, 0.15);
    --card-bg: rgba(67, 56, 44, 0.02);
    --graph-container-bg: rgba(67, 56, 44, 0.03);
    --scrollbar-thumb: rgba(124, 110, 94, 0.4);
    --scrollbar-track: rgba(67, 56, 44, 0.05);
    --body-bg-gradient: radial-gradient(circle at 15% 20%, rgba(139, 92, 246, 0.04) 0%, transparent 40%),
                         radial-gradient(circle at 85% 80%, rgba(244, 63, 94, 0.02) 0%, transparent 40%);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Outfit', sans-serif;
    -webkit-font-smoothing: antialiased;
}

body {
    background-color: var(--bg-primary);
    color: var(--text-primary);
    overflow-x: hidden;
    min-height: 100vh;
    background-image: var(--body-bg-gradient);
    transition: background-color 0.3s, color 0.3s, background-image 0.3s;
}

/* Скроллбар */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: var(--scrollbar-track);
}
::-webkit-scrollbar-thumb {
    background: var(--scrollbar-thumb);
    border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
    background: rgba(99, 102, 241, 0.6);
}

/* Оболочка приложения */
.app-container {
    display: flex;
    min-height: 100vh;
}

@media (max-width: 1024px) {
    .app-container {
        flex-direction: column;
    }

    .main-content {
        order: 1;
    }

    .sidebar {
        order: 2;
    }
}

/* Боковая панель ввода */
.sidebar {
    width: 380px;
    background-color: var(--sidebar-bg);
    border-right: 1px solid var(--border-color);
    padding: 1.5rem;
    overflow-y: auto;
    max-height: 100vh;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    backdrop-filter: blur(16px);
    z-index: 10;
}

@media (max-width: 1024px) {
    .sidebar {
        width: 100%;
        max-height: none;
    }
}

.logo-container {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 1rem;
}

.logo-icon {
    font-size: 1.75rem;
    background: linear-gradient(135deg, var(--accent-blue), var(--accent-purple));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    font-weight: 500;
}

.logo-text {
    font-size: 1.15rem;
    font-weight: 500;
    letter-spacing: 0.5px;
}

.logo-sub {
    font-size: 0.75rem;
    color: var(--accent-indigo);
    font-weight: 400;
    text-transform: uppercase;
    display: block;
    margin-top: -2px;
}

.channel-card {
    display: grid;
    grid-template-columns: 52px minmax(0, 1fr) 24px;
    align-items: center;
    gap: 0.75rem;
    text-decoration: none;
    color: var(--text-primary);
    background: linear-gradient(135deg, rgba(15, 23, 42, 0.8), rgba(30, 41, 59, 0.45));
    border: 1px solid rgba(249, 115, 22, 0.28);
    border-radius: 12px;
    padding: 0.75rem;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
    transition: border-color 0.2s, transform 0.2s, box-shadow 0.2s;
}

body[data-theme="light"] .channel-card,
body[data-theme="cream"] .channel-card {
    background: var(--bg-secondary);
}

.channel-card:hover {
    transform: translateY(-1px);
    border-color: rgba(249, 115, 22, 0.55);
    box-shadow: 0 10px 28px rgba(249, 115, 22, 0.12);
}

.channel-logo {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    object-fit: cover;
    border: 1px solid rgba(249, 115, 22, 0.35);
}

.channel-copy {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.12rem;
}

.channel-label {
    font-size: 0.62rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.channel-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.channel-sub {
    font-size: 0.72rem;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.channel-icon {
    color: #ff0033;
    font-size: 1.1rem;
    justify-self: end;
}

/* Секции ввода */
.input-section {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 0.85rem;
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
}

.section-title {
    list-style: none;
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-secondary);
    border-left: 2px solid var(--accent-indigo);
    padding-left: 0.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
}

.section-title::-webkit-details-marker {
    display: none;
}

.section-title i {
    color: var(--text-muted);
    font-size: 0.72rem;
    transition: transform 0.2s ease;
}

.input-section[open] .section-title i {
    transform: rotate(180deg);
}

.section-content {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
    padding-top: 0.1rem;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

label {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 400;
}

input[type="text"],
input[type="number"],
select {
    background-color: var(--input-bg);
    border: 1px solid var(--input-border);
    border-radius: 8px;
    padding: 0.5rem 0.75rem;
    color: var(--text-primary);
    font-size: 0.9rem;
    outline: none;
    transition: all 0.2s;
    font-family: 'JetBrains Mono', monospace;
}

select option {
    background-color: var(--bg-primary);
    color: var(--text-primary);
}

input[type="text"]:focus,
input[type="number"]:focus,
select:focus {
    border-color: var(--accent-indigo);
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.2);
}

input:disabled,
select:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background-color: rgba(0, 0, 0, 0.1) !important;
    border-color: var(--border-color) !important;
}

.slider-container {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

input[type="range"] {
    flex-grow: 1;
    -webkit-appearance: none;
    background: rgba(255, 255, 255, 0.1);
    height: 4px;
    border-radius: 2px;
    outline: none;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--accent-indigo);
    cursor: pointer;
    box-shadow: 0 0 8px var(--accent-indigo);
    transition: transform 0.1s;
}

input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

.slider-val {
    width: 60px;
    text-align: right;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.85rem;
    color: var(--accent-blue);
    font-weight: 500;
}

/* Главная область вывода */
.main-content {
    flex-grow: 1;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    max-height: 100vh;
    overflow-y: auto;
}

@media (max-width: 1024px) {
    .main-content {
        max-height: none;
    }
}

/* Вкладки (Tabs) */
.tabs-header {
    display: flex;
    gap: 0.5rem;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 2px;
}

.tab-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    padding: 0.7rem 1rem;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 400;
    transition: all 0.2s;
    border-radius: 8px 8px 0 0;
    position: relative;
}

.tab-btn:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.03);
}

.tab-btn.active {
    color: var(--text-primary);
    font-weight: 500;
}

.tab-btn.active::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 100%;
    height: 3px;
    background: linear-gradient(90deg, var(--accent-blue), var(--accent-purple));
    border-radius: 3px 3px 0 0;
    box-shadow: 0 0 10px var(--accent-indigo);
}

.tab-content {
    display: none;
    flex-direction: column;
    gap: 1.5rem;
}

.tab-content.active {
    display: flex;
}

/* Панель метрик (Сценарий) */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
}

.metric-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 0.85rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
    position: relative;
    overflow: hidden;
    box-shadow: none;
}

.metric-title {
    font-size: 0.7rem;
    font-weight: 400;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    margin-bottom: 0.25rem;
}

.metric-val {
    font-size: 1.35rem;
    font-weight: 500;
    color: var(--text-primary);
    font-family: 'JetBrains Mono', monospace;
}

.metric-sub {
    font-size: 0.65rem;
    color: var(--text-muted);
    margin-top: 0.15rem;
}

.insight-panel {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(420px, 0.95fr);
    gap: 1rem;
    align-items: stretch;
    padding: 1rem;
    background:
        linear-gradient(135deg, rgba(59, 130, 246, 0.08), rgba(16, 185, 129, 0.045)),
        var(--card-bg);
    border: 1px solid rgba(59, 130, 246, 0.18);
    border-left: 3px solid var(--accent-blue);
    border-radius: 8px;
}

.insight-panel.insight-summary {
    grid-template-columns: 1fr;
}

.insight-panel.warn {
    border-color: rgba(245, 158, 11, 0.32);
    border-left-color: #F59E0B;
    background:
        linear-gradient(135deg, rgba(245, 158, 11, 0.09), rgba(59, 130, 246, 0.035)),
        var(--card-bg);
}

.insight-panel.bad {
    border-color: rgba(239, 68, 68, 0.32);
    border-left-color: var(--accent-red);
    background:
        linear-gradient(135deg, rgba(239, 68, 68, 0.1), rgba(236, 72, 153, 0.035)),
        var(--card-bg);
}

.insight-primary {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 0.35rem;
    min-width: 0;
}

.insight-kicker,
.insight-stat span {
    color: var(--text-muted);
    font-size: 0.68rem;
    font-weight: 500;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

#enob-limiter {
    color: var(--text-primary);
    font-size: 1.05rem;
    font-weight: 600;
}

#enob-detail {
    color: var(--text-secondary);
    font-size: 0.88rem;
    line-height: 1.45;
}

.insight-stats {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.65rem;
}

.insight-stat {
    min-height: 70px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 0.25rem;
    padding: 0.7rem;
    background: rgba(255, 255, 255, 0.028);
    border: 1px solid var(--border-color);
    border-radius: 8px;
}

body[data-theme="light"] .insight-stat,
body[data-theme="cream"] .insight-stat {
    background: rgba(255, 255, 255, 0.48);
}

.insight-stat strong {
    color: var(--text-primary);
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.92rem;
    font-weight: 500;
    line-height: 1.25;
    overflow-wrap: anywhere;
}

.loss-decomp-panel {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.16);
}

.loss-decomp-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    flex-wrap: wrap;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.diagnostic-table-wrap {
    width: 100%;
    overflow-x: auto;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.02);
}

body[data-theme="light"] .diagnostic-table-wrap,
body[data-theme="cream"] .diagnostic-table-wrap {
    background: rgba(255, 255, 255, 0.5);
}

.diagnostic-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 760px;
}

.diagnostic-table th,
.diagnostic-table td {
    padding: 0.62rem 0.75rem;
    border-bottom: 1px solid var(--border-color);
    text-align: left;
    vertical-align: top;
    font-size: 0.82rem;
    line-height: 1.35;
}

.diagnostic-table tbody:last-child tr:last-child td {
    border-bottom: none;
}

.diagnostic-table th {
    color: var(--text-muted);
    font-size: 0.68rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.diagnostic-table th:nth-child(1),
.diagnostic-table td:nth-child(1) {
    color: var(--text-primary);
    font-weight: 500;
    width: 27%;
}

.diagnostic-table th:nth-child(2),
.diagnostic-table td:nth-child(2),
.diagnostic-table th:nth-child(3),
.diagnostic-table td:nth-child(3) {
    color: var(--text-primary);
    font-family: 'JetBrains Mono', monospace;
    width: 16%;
    white-space: nowrap;
}

.diagnostic-table th:nth-child(4),
.diagnostic-table td:nth-child(4) {
    color: var(--text-secondary);
}

.diagnostic-table .diag-section-row th {
    padding: 0.44rem 0.75rem;
    border-top: 1px solid var(--border-color);
    border-bottom: 1px solid var(--border-color);
    font-size: 0.68rem;
    font-family: inherit;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.diagnostic-table .diag-section:first-of-type .diag-section-row th {
    border-top: none;
}

.diagnostic-table .diag-section-main .diag-section-row th {
    color: #356a99;
    background: rgba(36, 104, 169, 0.085);
    box-shadow: inset 3px 0 0 rgba(36, 104, 169, 0.42);
}

.diagnostic-table .diag-section-spectrum .diag-section-row th {
    color: #34765b;
    background: rgba(36, 122, 85, 0.075);
    box-shadow: inset 3px 0 0 rgba(36, 122, 85, 0.38);
}

.diagnostic-table .diag-section-ablation .diag-section-row th {
    color: #67598d;
    background: rgba(102, 86, 154, 0.075);
    box-shadow: inset 3px 0 0 rgba(102, 86, 154, 0.36);
}

.diagnostic-table .diag-group-main td {
    background: rgba(59, 130, 246, 0.045);
}

.diagnostic-table .diag-group-spectrum td {
    background: rgba(16, 185, 129, 0.045);
}

.diagnostic-table .diag-group-ablation td {
    background: rgba(236, 72, 153, 0.04);
}

/* Warnings */
.warning-panel {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.25);
    border-radius: 12px;
    padding: 0.75rem 1.25rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: var(--accent-red);
    font-weight: 600;
    font-size: 0.9rem;
    display: none; /* скрыто по умолчанию */
}

.warning-panel.visible {
    display: flex;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4); }
    70% { box-shadow: 0 0 0 10px rgba(239, 68, 68, 0); }
    100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}

/* Sponsorship and advertising slots */
.ad-slot {
    position: relative;
    min-height: 72px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
    text-align: center;
    color: var(--text-muted);
    background:
        linear-gradient(135deg, rgba(255, 255, 255, 0.035), rgba(255, 255, 255, 0.01)),
        repeating-linear-gradient(135deg, transparent 0 10px, rgba(255, 255, 255, 0.025) 10px 20px);
    border: 1px dashed rgba(156, 163, 175, 0.32);
    border-radius: 10px;
    overflow: hidden;
}

.ad-slot::before {
    content: '';
    position: absolute;
    inset: 0;
    pointer-events: none;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.02);
}

.ad-slot-horizontal {
    min-height: 70px;
}

.ad-slot-sidebar {
    min-height: 250px;
}

.ad-label {
    font-size: 0.62rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--text-muted);
}

.ad-title {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.ad-size {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.72rem;
    color: var(--text-muted);
}

/* Сетка графиков */
.graphs-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
}

@media (max-width: 1400px) {
    .graphs-grid {
        grid-template-columns: 1fr;
    }
}

.graph-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.25rem;
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.22);
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.graph-card.full-width {
    grid-column: 1 / -1;
}

.graph-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.75rem;
    line-height: 1.35;
}

.graph-title > span:first-child {
    min-width: 0;
}

.graph-title .loading-sub {
    flex-shrink: 0;
    text-align: right;
    white-space: nowrap;
}

.graph-container {
    height: 380px;
    width: 100%;
    background: var(--graph-container-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden;
}

.graph-container-compact {
    height: 330px;
}

.sweep-axis-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.25rem;
    margin-top: 0.5rem;
}

.sweep-range-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.85rem;
    margin-top: 0.35rem;
}

.sweep-range-row {
    display: grid;
    grid-template-columns: minmax(96px, 0.18fr) minmax(0, 1fr);
    align-items: end;
    gap: 0.85rem;
}

.sweep-range-heading {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    min-height: 39px;
    color: var(--text-secondary);
    font-size: 0.82rem;
    font-weight: 500;
}

.range-unit {
    color: var(--accent-blue);
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.74rem;
    font-weight: 500;
}

.sweep-range-fields {
    display: grid;
    grid-template-columns: repeat(4, minmax(90px, 1fr));
    gap: 0.75rem;
}

.sweep-range-fields input,
.sweep-range-fields select {
    width: 100%;
}

/* Кнопки */
.btn-primary {
    background: linear-gradient(135deg, var(--accent-indigo) 0%, var(--accent-purple) 100%);
    color: white;
    border: none;
    border-radius: 8px;
    padding: 0.75rem 1.25rem;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.3);
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.5);
}

.btn-primary:active {
    transform: translateY(1px);
}

/* Экран загрузки */
#loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: var(--bg-primary);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 1.5rem;
    transition: opacity 0.5s ease-out, visibility 0.5s;
}

#loading-overlay.hidden {
    display: none !important;
    opacity: 0 !important;
    visibility: hidden !important;
    pointer-events: none !important;
}

.spinner {
    width: 60px;
    height: 60px;
    border: 3px solid rgba(99, 102, 241, 0.1);
    border-radius: 50%;
    border-top-color: var(--accent-indigo);
    border-bottom-color: var(--accent-purple);
    animation: spin 1.5s cubic-bezier(0.53, 0.21, 0.29, 0.67) infinite;
    position: relative;
}

.spinner::after {
    content: '';
    position: absolute;
    top: 10px;
    left: 10px;
    right: 10px;
    bottom: 10px;
    border: 3px solid rgba(236, 72, 153, 0.1);
    border-radius: 50%;
    border-top-color: var(--accent-pink);
    animation: spin-reverse 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

@keyframes spin-reverse {
    to { transform: rotate(-360deg); }
}

.loading-text {
    font-size: 1.1rem;
    font-weight: 500;
    color: var(--text-primary);
    letter-spacing: 1px;
    text-transform: uppercase;
}

.loading-sub {
    font-size: 0.85rem;
    color: var(--accent-blue);
    font-family: 'JetBrains Mono', monospace;
}

/* Layout Navigation & Actions */
.tabs-nav-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.5rem;
    gap: 1rem;
}

.calc-status {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    min-width: 124px;
    height: 34px;
    padding: 0 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-secondary);
    color: var(--text-secondary);
    font-size: 0.78rem;
    font-weight: 500;
    white-space: nowrap;
}

.status-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--accent-green);
    box-shadow: 0 0 8px rgba(16, 185, 129, 0.55);
}

.calc-status.updating .status-dot,
.calc-status.sweeping .status-dot {
    background: var(--accent-blue);
    box-shadow: 0 0 8px rgba(59, 130, 246, 0.7);
    animation: statusPulse 1s infinite;
}

.calc-status.error .status-dot {
    background: var(--accent-red);
    box-shadow: 0 0 8px rgba(239, 68, 68, 0.7);
}

@keyframes statusPulse {
    0%, 100% { opacity: 0.45; transform: scale(0.9); }
    50% { opacity: 1; transform: scale(1.2); }
}

@media (max-width: 768px) {
    .tabs-nav-container {
        flex-direction: column;
        align-items: stretch;
    }

    .ad-slot-horizontal {
        min-height: 62px;
        order: 3;
    }

    .tabs-header {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 0.25rem;
    }

    .tab-btn {
        padding: 0.65rem 0.35rem;
        font-size: 0.78rem;
    }

    .top-actions {
        justify-content: space-between;
        flex-wrap: wrap;
    }

    .calc-status {
        flex: 1;
    }

    .validation-banner {
        grid-template-columns: 1fr;
        gap: 0.5rem;
    }

    .validation-icon {
        display: none;
    }

    .main-content {
        padding: 1rem;
        gap: 1rem;
    }

    .sidebar {
        padding: 1rem;
        gap: 1rem;
    }

    .metrics-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 0.75rem;
    }

    .insight-panel {
        grid-template-columns: 1fr;
        gap: 0.85rem;
        padding: 0.85rem;
    }

    .insight-stats {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .graphs-grid {
        gap: 1rem;
    }

    .graph-card {
        padding: 0.85rem;
    }

    .graph-container {
        height: 320px;
    }

    .graph-container-compact {
        height: 310px;
    }

    .sweep-range-row {
        grid-template-columns: 1fr;
        gap: 0.45rem;
    }

    .sweep-range-heading {
        min-height: auto;
    }

    .sweep-range-fields {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

.top-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.theme-selector {
    display: flex;
    background: rgba(0, 0, 0, 0.15);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 2px;
}

body[data-theme="light"] .theme-selector {
    background: rgba(0, 0, 0, 0.05);
}
body[data-theme="cream"] .theme-selector {
    background: rgba(0, 0, 0, 0.05);
}

.theme-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 0.85rem;
    border-radius: 6px;
    transition: all 0.2s;
}

.theme-btn:hover {
    color: var(--text-primary);
}

.theme-btn.active {
    background: var(--accent-indigo);
    color: white;
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.3);
}

/* Secondary Action Button */
.btn-secondary {
    background: var(--bg-secondary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 0.45rem 0.85rem;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 0.35rem;
    box-shadow: var(--card-shadow);
}

.btn-secondary:hover {
    background: var(--border-color);
    border-color: var(--text-secondary);
}

.btn-secondary:disabled,
.btn-secondary.is-busy {
    cursor: wait;
    opacity: 0.68;
}

.validation-banner {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 0.9rem;
    border: 1px solid var(--border-color);
    border-left: 3px solid #6f7d87;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.022);
    color: var(--text-secondary);
    box-shadow: none;
}

body[data-theme="light"] .validation-banner,
body[data-theme="cream"] .validation-banner {
    background: rgba(255, 255, 255, 0.62);
    border-left-color: #557a92;
}

.validation-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border: 1px solid var(--border-color);
    border-radius: 50%;
    color: #557a92;
    background: rgba(85, 122, 146, 0.08);
}

.validation-copy {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0.35rem 0.7rem;
    min-width: 0;
    line-height: 1.4;
}

.validation-copy strong {
    color: var(--text-primary);
    font-size: 0.82rem;
    font-weight: 600;
    white-space: nowrap;
}

.validation-copy span {
    color: var(--text-secondary);
    font-size: 0.82rem;
}

/* Capacitor Library Styles */
.library-container {
    display: grid;
    grid-template-columns: minmax(0, 3fr) minmax(360px, 2fr);
    gap: 1.5rem;
    height: calc(100vh - 105px);
    min-height: 560px;
    max-width: 100%;
    overflow: hidden;
}

.library-container > .table-card,
.library-container > .chart-card {
    min-width: 0;
    min-height: 0;
    overflow: hidden;
}

@media (max-width: 1200px) {
    .library-container {
        grid-template-columns: 1fr;
        height: auto;
        min-height: 0;
        overflow: visible;
    }

    .library-container > .table-card,
    .library-container > .chart-card {
        min-height: 520px;
    }
}

@media (max-width: 768px) {
    .library-title-bar {
        align-items: stretch;
    }

    .search-container,
    #library-search {
        width: 100%;
    }

    .table-scroll-container {
        overflow-x: auto;
    }

    .library-table {
        min-width: 720px;
    }
}

.library-title-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.search-container {
    position: relative;
}

.search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 0.85rem;
}

#library-search {
    padding-left: 2.2rem;
    width: 300px;
    font-size: 0.85rem;
    height: 36px;
    background-color: var(--input-bg);
    border: 1px solid var(--input-border);
    border-radius: 8px;
    color: var(--text-primary);
    outline: none;
    transition: all 0.2s;
}

#library-search:focus {
    border-color: var(--accent-indigo);
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.2);
}

.table-scroll-container {
    min-width: 0;
    max-width: 100%;
    overflow-y: auto;
    overflow-x: hidden;
    flex-grow: 1;
    margin-top: 1rem;
    max-height: none;
    border: 1px solid var(--border-color);
    border-radius: 8px;
}

.library-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
    text-align: left;
    font-size: 0.85rem;
}

.library-col-compare { width: 6%; }
.library-col-part { width: 23%; }
.library-col-mfr { width: 12%; }
.library-col-cap { width: 15%; }
.library-col-voltage { width: 10%; }
.library-col-dielectric { width: 13%; }
.library-col-size { width: 9%; }
.library-col-action { width: 12%; }

.library-table th {
    background-color: var(--bg-secondary);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    color: var(--text-secondary);
    font-weight: 600;
    padding: 0.75rem 0.5rem;
    position: sticky;
    top: 0;
    z-index: 10;
    border-bottom: 2px solid var(--border-color);
}

.library-table td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
    overflow-wrap: anywhere;
}

.library-table th,
.library-table td {
    min-width: 0;
}

.library-table th:nth-child(3),
.library-table td:nth-child(3),
.library-table th:nth-child(4),
.library-table td:nth-child(4),
.library-table th:nth-child(5),
.library-table td:nth-child(5),
.library-table th:nth-child(6),
.library-table td:nth-child(6),
.library-table th:nth-child(7),
.library-table td:nth-child(7),
.library-table th:nth-child(8),
.library-table td:nth-child(8) {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.btn-table-apply {
    white-space: nowrap;
}

.library-plot {
    flex: 1 1 auto;
    width: 100%;
    height: auto;
    min-width: 0;
    min-height: 0;
    overflow: hidden;
}

.library-plot .plot-container,
.library-plot .svg-container,
.library-plot .main-svg {
    max-width: 100%;
}

.library-table tr:hover td {
    background-color: rgba(99, 102, 241, 0.05);
}

.btn-table-apply {
    background: var(--accent-blue);
    color: #ffffff;
    border: none;
    border-radius: 6px;
    padding: 0.35rem 0.75rem;
    font-size: 0.75rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-table-apply:hover {
    background: #2563EB;
    box-shadow: 0 0 8px rgba(37, 99, 235, 0.4);
}

/* Strict engineering visual system */
:root {
    --bg-primary: #11161c;
    --bg-secondary: #171d24;
    --border-color: #303944;
    --text-primary: #e6ebf0;
    --text-secondary: #a9b2bc;
    --text-muted: #77828e;
    --accent-blue: #4b91e2;
    --accent-indigo: #4b91e2;
    --accent-purple: #8b78c6;
    --accent-pink: #c76f92;
    --accent-green: #3ba272;
    --accent-red: #d45d5d;
    --sidebar-bg: #141a21;
    --input-bg: #10151b;
    --input-border: #35404b;
    --card-bg: #171d24;
    --graph-container-bg: #10151b;
    --scrollbar-thumb: #46515d;
    --scrollbar-track: #171d24;
    --body-bg-gradient: none;
    --card-shadow: none;
    --glow-shadow: none;
}

body[data-theme="light"],
body[data-theme="cream"] {
    --bg-primary: #f3f5f7;
    --bg-secondary: #ffffff;
    --border-color: #d4d9df;
    --text-primary: #20262d;
    --text-secondary: #505b66;
    --text-muted: #77818b;
    --accent-blue: #2468a9;
    --accent-indigo: #2468a9;
    --accent-purple: #66569a;
    --accent-pink: #9d4f70;
    --accent-green: #247a55;
    --accent-red: #b64242;
    --sidebar-bg: #e9edf1;
    --input-bg: #ffffff;
    --input-border: #c9d0d7;
    --card-bg: #ffffff;
    --graph-container-bg: #fafbfc;
    --scrollbar-thumb: #a9b1ba;
    --scrollbar-track: #e7ebef;
    --body-bg-gradient: none;
    --card-shadow: none;
    --glow-shadow: none;
}

body {
    background-image: none;
    transition: none;
}

.sidebar {
    width: 340px;
    flex: 0 0 340px;
    padding: 1rem;
    gap: 1rem;
    background: var(--sidebar-bg);
    backdrop-filter: none;
}

.logo-container {
    padding-bottom: 0.8rem;
}

.logo-icon {
    color: var(--accent-blue);
    background: none;
    -webkit-text-fill-color: currentColor;
    font-size: 1.45rem;
}

.logo-text {
    font-size: 1rem;
    font-weight: 600;
    letter-spacing: 0;
}

.logo-sub {
    color: var(--text-muted);
    font-size: 0.66rem;
    letter-spacing: 0.06em;
}

.channel-card {
    grid-template-columns: 34px minmax(0, 1fr) 18px;
    gap: 0.6rem;
    padding: 0.55rem 0.65rem;
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    box-shadow: none;
    transition: border-color 0.15s, background-color 0.15s;
}

body[data-theme="light"] .channel-card,
body[data-theme="cream"] .channel-card {
    background: transparent;
}

.channel-card:hover {
    transform: none;
    border-color: var(--accent-blue);
    background: rgba(75, 145, 226, 0.06);
    box-shadow: none;
}

.channel-logo {
    width: 34px;
    height: 34px;
    border-radius: 3px;
    border: 1px solid var(--border-color);
}

.channel-label,
.channel-sub {
    font-size: 0.62rem;
}

.channel-title {
    font-size: 0.8rem;
}

.input-section {
    background: transparent;
    border: 0;
    border-top: 1px solid var(--border-color);
    border-radius: 0;
    padding: 0.8rem 0 0;
}

.section-title {
    padding: 0;
    font-size: 0.72rem;
    letter-spacing: 0.06em;
}

.section-content {
    gap: 0.7rem;
    padding-top: 0.75rem;
}

input[type="text"],
input[type="number"],
select {
    min-height: 34px;
    border-radius: 4px;
    padding: 0.42rem 0.6rem;
    font-size: 0.82rem;
    transition: border-color 0.15s;
}

input[type="text"]:focus,
input[type="number"]:focus,
select:focus {
    border-color: var(--accent-blue);
    box-shadow: none;
}

input[type="range"] {
    height: 3px;
    border-radius: 0;
}

input[type="range"]::-webkit-slider-thumb {
    width: 12px;
    height: 12px;
    background: var(--accent-blue);
    box-shadow: none;
}

.main-content {
    flex: 1 1 0;
    min-width: 0;
    padding: 1rem 1.25rem;
    gap: 1rem;
}

.tabs-nav-container {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 0 0.75rem;
}

.tab-btn {
    min-height: 46px;
    padding: 0 0.8rem;
    font-size: 0.82rem;
}

.tab-btn:hover {
    background: rgba(75, 145, 226, 0.06);
}

.tab-btn.active::after {
    height: 2px;
    background: var(--accent-blue);
    border-radius: 0;
    box-shadow: none;
}

.theme-selector {
    background: transparent;
    border-radius: 4px;
}

.theme-btn {
    border-radius: 2px;
}

.theme-btn.active {
    background: var(--accent-blue);
    box-shadow: none;
}

.calc-status {
    border-radius: 3px;
    box-shadow: none;
}

.status-dot {
    box-shadow: none !important;
}

.btn-primary {
    background: var(--accent-blue);
    border: 1px solid var(--accent-blue);
    border-radius: 4px;
    box-shadow: none;
    font-size: 0.84rem;
}

.btn-primary:hover {
    transform: none;
    background: #1f5f99;
    box-shadow: none;
}

.btn-secondary {
    border-radius: 4px;
    box-shadow: none;
}

.insight-panel {
    padding: 0.85rem 1rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-left: 3px solid var(--accent-blue);
    border-radius: 4px;
}

.insight-panel.warn,
.insight-panel.bad {
    background: var(--bg-secondary);
}

.loss-decomp-panel,
.graph-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    box-shadow: none;
}

.loss-decomp-panel,
.graph-card {
    padding: 0.9rem;
}

.graph-title,
.loss-decomp-title {
    font-size: 0.88rem;
    font-weight: 600;
}

.graph-container,
.diagnostic-table-wrap {
    background: var(--graph-container-bg);
    border: 1px solid var(--border-color);
    border-radius: 3px;
}

body[data-theme="light"] .diagnostic-table-wrap,
body[data-theme="cream"] .diagnostic-table-wrap {
    background: var(--graph-container-bg);
}

.diagnostic-table .diag-group-main td {
    background: rgba(36, 104, 169, 0.032);
}

.diagnostic-table .diag-group-spectrum td {
    background: rgba(36, 122, 85, 0.028);
}

.diagnostic-table .diag-group-ablation td {
    background: rgba(102, 86, 154, 0.028);
}

.metric-help-link {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0;
    border: 0;
    background: transparent;
    color: inherit;
    font: inherit;
    font-weight: inherit;
    cursor: pointer;
    text-align: left;
}

.metric-help-link i {
    color: var(--text-muted);
    font-size: 0.72rem;
}

.metric-help-link:hover,
.metric-help-link:hover i {
    color: var(--accent-blue);
}

.warning-panel {
    border-radius: 4px;
    animation: none !important;
}

.ad-slot {
    min-height: 56px;
    background: transparent;
    border: 1px dashed var(--border-color);
    border-radius: 3px;
}

.ad-slot::before {
    display: none;
}

.ad-slot-sidebar {
    min-height: 120px;
}

.ad-title {
    font-size: 0.78rem;
}

.library-table th {
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
}

.library-table tr:hover td {
    background: rgba(75, 145, 226, 0.05);
}

.btn-table-apply {
    border-radius: 3px;
    box-shadow: none;
}

.btn-table-apply:hover {
    box-shadow: none;
}

/* Methodology */
.method-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    padding: 1rem 0 1.25rem;
    border-bottom: 1px solid var(--border-color);
}

.method-header h1 {
    margin: 0.15rem 0 0.4rem;
    font-size: 1.45rem;
    font-weight: 600;
    letter-spacing: 0;
}

.method-header p {
    color: var(--text-secondary);
    max-width: 760px;
    line-height: 1.5;
}

.method-eyebrow {
    color: var(--accent-blue);
    font-size: 0.68rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.method-back {
    flex-shrink: 0;
}

body.methodology-open .app-container,
body.library-open .app-container,
body.about-open .app-container {
    display: block;
}

body.methodology-open .sidebar,
body.library-open .sidebar,
body.about-open .sidebar {
    display: none;
}

body.methodology-open .main-content,
body.library-open .main-content,
body.about-open .main-content {
    width: 100%;
    max-height: 100vh;
}

.method-layout {
    display: grid;
    grid-template-columns: 210px minmax(0, 1fr);
    gap: 2rem;
    align-items: start;
}

.method-toc {
    position: sticky;
    top: 0;
    display: flex;
    flex-direction: column;
    border-left: 2px solid var(--border-color);
}

.method-toc a {
    padding: 0.48rem 0.75rem;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.8rem;
    border-left: 2px solid transparent;
    margin-left: -2px;
}

.method-toc a:hover {
    color: var(--accent-blue);
    border-left-color: var(--accent-blue);
}

.method-content {
    min-width: 0;
}

.method-section {
    display: grid;
    grid-template-columns: 42px minmax(0, 1fr);
    gap: 1rem;
    padding: 1.5rem 0;
    border-bottom: 1px solid var(--border-color);
    scroll-margin-top: 1rem;
    transition: background-color 0.3s;
}

.method-section-focus {
    background: rgba(75, 145, 226, 0.08);
}

.method-section-index {
    color: var(--text-muted);
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.72rem;
    padding-top: 0.25rem;
}

.method-section h2 {
    font-size: 1.08rem;
    font-weight: 600;
    margin-bottom: 0.65rem;
}

.method-section p {
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 0.65rem;
}

.method-note {
    margin-top: 0.8rem;
    padding: 0.75rem 0.9rem;
    border-left: 3px solid var(--accent-blue);
    background: rgba(75, 145, 226, 0.06);
    color: var(--text-secondary);
    line-height: 1.5;
}

.formula-grid {
    display: grid;
    gap: 0.5rem;
}

.formula-block {
    padding: 0.7rem 0.85rem;
    border: 1px solid var(--border-color);
    background: var(--graph-container-bg);
    overflow-x: auto;
}

.formula-block code {
    color: var(--text-primary);
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.82rem;
    white-space: nowrap;
}

.definition-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 0.8rem;
}

.definition-table th,
.definition-table td {
    padding: 0.58rem 0.65rem;
    border-bottom: 1px solid var(--border-color);
    text-align: left;
    vertical-align: top;
    font-size: 0.82rem;
}

.definition-table th {
    width: 160px;
    color: var(--text-primary);
    font-family: 'JetBrains Mono', monospace;
    font-weight: 500;
}

.definition-table td {
    color: var(--text-secondary);
    line-height: 1.5;
}

.method-list {
    display: grid;
    gap: 0.5rem;
    padding-left: 1.15rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

.circuit-schematic {
    width: 100%;
    overflow-x: auto;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    background: var(--graph-container-bg);
}

.method-section:has(.circuit-schematic) > div:last-child {
    overflow-x: auto;
}

.circuit-svg {
    display: block;
    width: 100%;
    min-width: 900px;
    height: auto;
    color: var(--text-primary);
}

.circuit-wire,
.circuit-symbol,
.circuit-ground,
.circuit-signal {
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
    vector-effect: non-scaling-stroke;
}

.circuit-signal {
    stroke: var(--accent-blue);
}

.circuit-node,
.circuit-symbol-fill,
.circuit-arrow-head {
    fill: currentColor;
}

.circuit-symbol-fill {
    stroke: var(--graph-container-bg);
    stroke-width: 2;
    vector-effect: non-scaling-stroke;
}

.circuit-adc {
    fill: var(--bg-secondary);
}

.circuit-label,
.circuit-caption {
    fill: var(--text-secondary);
    font-family: 'JetBrains Mono', monospace;
    font-size: 14px;
    letter-spacing: 0;
}

.circuit-label-strong {
    fill: var(--text-primary);
    font-weight: 600;
}

.circuit-caption {
    fill: var(--text-muted);
    font-family: Inter, sans-serif;
    font-size: 12px;
}

@media (max-width: 1024px) {
    .sidebar {
        width: 100%;
        flex: 0 0 auto;
    }

    .method-layout {
        grid-template-columns: 1fr;
    }

    .method-toc {
        position: static;
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        border-left: 0;
        border-bottom: 1px solid var(--border-color);
        padding-bottom: 0.75rem;
    }

    .method-toc a {
        margin: 0;
        border-left: 0;
    }
}

@media (max-width: 768px) {
    .method-header {
        flex-direction: column;
    }

    .method-section {
        grid-template-columns: 1fr;
        gap: 0.35rem;
    }

    .method-toc {
        grid-template-columns: 1fr;
    }

    .diagnostic-table {
        min-width: 0;
        table-layout: fixed;
    }

    .diagnostic-table thead th:nth-child(4),
    .diagnostic-table tbody tr:not(.diag-section-row) td:nth-child(4) {
        display: none;
    }

    .diagnostic-table th,
    .diagnostic-table td {
        padding: 0.55rem 0.45rem;
        font-size: 0.74rem;
    }

    .diagnostic-table th:nth-child(1),
    .diagnostic-table td:nth-child(1) {
        width: 46%;
    }

    .diagnostic-table th:nth-child(2),
    .diagnostic-table td:nth-child(2) {
        width: 29%;
        white-space: normal;
        overflow-wrap: anywhere;
    }

    .diagnostic-table th:nth-child(3),
    .diagnostic-table td:nth-child(3) {
        width: 25%;
        white-space: normal;
        overflow-wrap: anywhere;
    }

    .diagnostic-table .diag-section-row th {
        width: auto;
        padding: 0.42rem 0.5rem;
    }

    .metric-help-link {
        line-height: 1.3;
    }
}



