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

:root {
    /* Color Palette - Dark Tier Premium */
    --bg-main: #0a0c10;
    --bg-side: #11141b;
    --bg-card: rgba(25, 29, 38, 0.7);
    --glass-bg: rgba(255, 255, 255, 0.03);
    --glass-border: rgba(255, 255, 255, 0.08);
    
    --accent-primary: #8b5cf6; 
    --accent-secondary: #10b981; 
    --accent-info: #3b82f6; 
    --accent-danger: #ef4444; 
    
    --text-main: #e2e8f0;
    --text-muted: #94a3b8;
    --text-dim: #64748b;
    
    --sidebar-width: 260px;
    
    --shadow-premium: 0 10px 30px rgba(0, 0, 0, 0.5);
    --shadow-accent: 0 0 20px rgba(139, 92, 246, 0.2);
    --transition-fast: 0.2s ease;
    --transition-mid: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --ui-card-radius: 22px;
    --ui-card-padding: 20px;
    --ui-row-radius: 18px;
    --ui-row-padding-y: 14px;
    --ui-row-padding-x: 12px;
}

.toast-root {
    position: fixed;
    top: 20px;
    right: 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 2000;
}

.toast {
    min-width: 260px;
    max-width: 380px;
    padding: 14px 16px;
    border-radius: 14px;
    color: #fff;
    background: rgba(15, 23, 42, 0.92);
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: var(--shadow-premium);
    opacity: 0;
    transform: translateY(-6px);
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.toast.visible {
    opacity: 1;
    transform: translateY(0);
}

.toast-info {
    border-color: rgba(59, 130, 246, 0.35);
}

.toast-success {
    border-color: rgba(16, 185, 129, 0.35);
}

.toast-error {
    border-color: rgba(239, 68, 68, 0.35);
}

.settings-nav {
    display: flex;
    gap: 10px;
    margin-bottom: 2rem;
    padding: 8px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 18px;
    width: 100%;
}

.tab-btn {
    flex: 1;
    justify-content: center;
    padding: 12px 20px;
    border-radius: 14px;
    border: 1px solid transparent;
    background: transparent;
    color: var(--text-dim);
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-fast);
    display: flex;
    align-items: center;
    gap: 8px;
}

.tab-btn:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.05);
}

.tab-btn.active {
    background: rgba(139, 92, 246, 0.1);
    border-color: rgba(139, 92, 246, 0.3);
    color: var(--accent-primary);
    box-shadow: var(--shadow-accent);
}

.tab-content {
    display: none;
    animation: fadeIn 0.3s ease;
}

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

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.settings-section {
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: var(--ui-card-padding);
    border-radius: var(--ui-card-radius);
}

.section-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 1rem;
    color: #fff;
}

.section-title i {
    color: var(--accent-primary);
}

.section-title-with-toggle {
    justify-content: space-between;
    gap: 1rem;
}

.section-title-main {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.section-title-toggle {
    margin-left: auto;
    flex-shrink: 0;
}

.pricing-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.9rem;
    align-items: start;
}

.price-input-group {
    background: rgba(255, 255, 255, 0.03);
    padding: 2rem;
    border-radius: 20px;
    border: 1px solid var(--glass-border);
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.plan-card-body {
    display: grid;
    grid-template-columns: 350px 1fr;
    gap: 2.5rem;
}

.plan-params-column {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.plan-params-column .form-group {
    margin-bottom: 0;
}

.plan-desc-column {
    display: flex;
    flex-direction: column;
}

.plan-desc-column .form-group {
    height: 100%;
    margin-bottom: 0;
}

.plan-desc-column textarea {
    flex-grow: 1;
    min-height: 250px;
}

.price-input-group h4 {
    margin-bottom: 0.5rem;
    font-weight: 700;
    font-size: 1.1rem;
    color: #fff;
    display: flex;
    align-items: center;
    gap: 8px;
}

.password-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.password-toggle {
    position: absolute;
    right: 12px;
    cursor: pointer;
    color: var(--text-dim);
    transition: var(--transition-fast);
}

.password-toggle:hover {
    color: #fff;
}

.settings-save-bar {
    position: fixed;
    left: 50%;
    bottom: 18px;
    transform: translateX(-50%);
    background: transparent;
    backdrop-filter: none;
    margin: 0;
    padding: 0;
    border-top: none;
    display: flex;
    justify-content: center;
    width: min(calc(100vw - 32px), 440px);
    z-index: 140;
}

.settings-save-bar-inline {
    position: static;
    left: auto;
    bottom: auto;
    transform: none;
    margin-top: 1.5rem;
    background: transparent;
    backdrop-filter: none;
    padding: 0;
    border-top: none;
    width: auto;
    justify-content: center;
}

.settings-save-bar .btn {
    min-width: 300px;
    width: 100%;
    box-shadow: 0 18px 38px rgba(0, 0, 0, 0.35);
}

.settings-save-bar-inline .btn {
    width: auto;
}

.save-settings-btn {
    min-height: 70px;
    min-width: 380px !important;
    border-radius: 18px;
    font-size: 2rem;
    font-weight: 700;
    letter-spacing: 0.01em;
}

.save-settings-btn i {
    width: 28px;
    height: 28px;
}

.settings-hint {
    font-size: 0.8rem;
    color: var(--text-dim);
    margin-top: 5px;
}

.settings-save-inline {
    margin-top: 0;
}

.settings-save-bordered {
    margin-top: 0;
}

.batch-settings-form {
    display: block;
    padding-bottom: 120px;
}

.btn-wide {
    min-width: 320px;
}

.placeholder-card {
    align-items: center;
    text-align: center;
    padding: 3rem 2rem;
    gap: 1rem;
}

.placeholder-icon {
    width: 64px;
    height: 64px;
    border-radius: 20px;
    display: grid;
    place-items: center;
    background: rgba(59, 130, 246, 0.12);
    border: 1px solid rgba(59, 130, 246, 0.2);
}

.placeholder-icon-glyph {
    width: 28px;
    height: 28px;
    color: #93c5fd;
}

.placeholder-title {
    margin: 0;
    font-family: 'Outfit', sans-serif;
    font-size: 1.5rem;
    color: #fff;
}

.placeholder-text {
    max-width: 520px;
    margin: 0;
    color: var(--text-muted);
    line-height: 1.6;
}

.placeholder-badge {
    margin-top: 0.5rem;
}

.field-compact {
    width: 100%;
    max-width: 320px;
}

.field-full {
    width: 100%;
}

/* Categories (MainCategory pool) */
.maincat-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.maincat-screen,
.discovery-screen {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.maincat-bottom-actions {
    display: flex;
    justify-content: flex-end;
}

.maincat-empty {
    padding: 1.1rem 1.25rem;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px dashed rgba(255, 255, 255, 0.12);
    color: var(--text-dim);
}

.maincat-item {
    display: grid;
    grid-template-columns: 120px minmax(300px, 1.55fr) minmax(260px, 1fr) auto;
    gap: 10px;
    align-items: center;
    padding: var(--ui-row-padding-y) var(--ui-row-padding-x);
    transition: var(--transition-fast);
}

.maincat-item:hover {
    border-color: rgba(255, 255, 255, 0.15);
    background: rgba(255, 255, 255, 0.03);
}

.maincat-col {
    min-width: 0;
}

.maincat-meta-col {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.maincat-name-col .form-input,
.maincat-slug-col .form-input {
    margin: 0;
    height: 40px;
    padding-top: 8px;
    padding-bottom: 8px;
    font-size: 0.96rem;
}

.maincat-pill {
    flex: 0 0 auto;
    font-size: 0.72rem;
    font-weight: 700;
    padding: 3px 9px;
    border-radius: 999px;
    background: rgba(139, 92, 246, 0.12);
    border: 1px solid rgba(139, 92, 246, 0.22);
    color: var(--accent-primary);
}

.maincat-id-col {
    font-size: 0.88rem;
    color: var(--text-muted);
    white-space: nowrap;
}

.maincat-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    justify-content: flex-end;
}

.maincat-actions .btn-icon {
    width: 38px;
    height: 38px;
    border-radius: 14px;
}

.maincat-actions .switch {
    transform: scale(0.94);
    transform-origin: center;
}

@media (max-width: 1380px) {
    .maincat-item {
        grid-template-columns: 110px minmax(240px, 1.3fr) minmax(220px, 1fr) auto;
    }
}

@media (max-width: 1120px) {
    .maincat-item {
        grid-template-columns: 110px minmax(220px, 1fr) minmax(180px, 0.95fr) auto;
    }

    .maincat-actions {
        align-self: center;
    }
}

@media (max-width: 820px) {
    .maincat-item {
        grid-template-columns: 1fr;
        gap: 10px;
        align-items: start;
    }

    .maincat-actions {
        grid-column: auto;
        grid-row: auto;
    }

    .maincat-actions {
        justify-content: flex-start;
    }
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-font-smoothing: antialiased;
}

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background: var(--bg-main);
    color: var(--text-main);
    height: 100vh;
    overflow: hidden;
    display: flex;
}

body.no-auth .sidebar,
body.no-auth .main-wrapper {
    display: none !important;
}

body.no-auth .modal-overlay {
    background: radial-gradient(circle at center, #1a1e26 0%, #0a0c10 100%);
    opacity: 1;
    visibility: visible;
}

body.no-auth #close-modal {
    display: none;
}

h1, h2, h3, .name, .value, .logo, .btn, .status-pill {
    font-family: 'Outfit', sans-serif !important;
}

/* Scrollbar */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--glass-border); border-radius: 10px; }

#app { display: flex; width: 100%; height: 100vh; }

/* Sidebar - Жесткая фиксация */
.sidebar {
    width: var(--sidebar-width);
    min-width: var(--sidebar-width);
    max-width: var(--sidebar-width);
    flex: 0 0 var(--sidebar-width) !important;
    background: var(--bg-side);
    border-right: 1px solid var(--glass-border);
    display: flex;
    flex-direction: column;
    padding: 1.5rem 1rem;
    z-index: 100;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 0.5rem 2.5rem;
    font-weight: 700;
    font-size: 1.35rem;
    color: #fff;
}

.logo span {
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-info));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.nav-links { list-style: none; flex-grow: 1; }
.nav-item { margin-bottom: 0.5rem; }

.nav-group-label {
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--text-dim);
    padding: 1.2rem 16px 0.4rem;
    opacity: 0.6;
}

.nav-group-label:first-child {
    padding-top: 0;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    text-decoration: none;
    color: var(--text-muted);
    border-radius: 12px;
    font-weight: 500;
    transition: var(--transition-fast);
}

.nav-link:hover { background: var(--glass-bg); color: #fff; }
.nav-link.active {
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.15), rgba(59, 130, 246, 0.15));
    border: 1px solid rgba(139, 92, 246, 0.3);
    color: #fff;
}

/* Main Content Area - Устойчивость к переполнениям */
.main-wrapper { 
    flex: 1; 
    min-width: 0; 
    display: flex;
    flex-direction: column;
    overflow: hidden; 
    position: relative; 
}

.content-body {
    flex-grow: 1;
    padding: 2rem;
    overflow-y: auto;
    max-height: 100vh;
    background: radial-gradient(circle at top right, rgba(139, 92, 246, 0.05), transparent 40%),
                radial-gradient(circle at bottom left, rgba(16, 185, 129, 0.03), transparent 40%);
}

/* Scraper Cards List */
.scrapers-list {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    width: 100%;
}

.scraper-card {
    padding: 0;
    overflow: hidden;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    background: var(--bg-card);
    width: 100%;
}

.scraper-main-row {
    display: flex;
    align-items: center;
    padding: 0 1.5rem;
    height: 75px; /* Уменьшеная высота */
    gap: 1.5rem;
    position: relative;
    z-index: 10;
}

.scraper-info { 
    flex: 0 0 220px; 
    display: flex;
    align-items: center;
}
.scraper-info .name { font-weight: 600; font-size: 1.2rem; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Колонки с подписями "сверху" */
.scraper-control, .scraper-time {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    height: 100%;
}

.control-label {
    position: absolute;
    top: 16px; /* Подняли чуть выше из-за уменьшения общей высоты */
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.6rem;
    color: var(--text-dim);
    letter-spacing: 0.15em;
    font-weight: 700;
    text-transform: uppercase;
    white-space: nowrap;
}

.scraper-time .value { font-size: 1rem; font-weight: 500; color: #fff; margin-top: 12px; }
.scraper-control .switch { margin-top: 12px; }

.scraper-status { 
    flex: 0 0 140px; 
    display: flex; 
    justify-content: center; 
    align-items: center;
}

.scraper-actions {
    display: flex;
    gap: 10px;
    flex: 0 0 170px;
    justify-content: flex-end;
    align-items: center;
}

/* Status Pills */
.status-pill {
    padding: 6px 14px;
    border-radius: 10px;
    font-size: 0.75rem;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}

.status-active { background: rgba(139, 92, 246, 0.15); color: var(--accent-primary); border: 1px solid rgba(139, 92, 246, 0.2); }
.status-success { background: rgba(16, 185, 129, 0.15); color: var(--accent-secondary); border: 1px solid rgba(16, 185, 129, 0.2); }
.status-error { background: rgba(239, 68, 68, 0.15); color: var(--accent-danger); border: 1px solid rgba(239, 68, 68, 0.2); }
.status-info { background: rgba(59, 130, 246, 0.15); color: var(--accent-info); border: 1px solid rgba(59, 130, 246, 0.2); }
.status-warning { background: rgba(245, 158, 11, 0.15); color: #fbbf24; border: 1px solid rgba(245, 158, 11, 0.22); }
.status-muted { background: rgba(148, 163, 184, 0.12); color: #cbd5e1; border: 1px solid rgba(148, 163, 184, 0.2); }
.status-danger { background: rgba(239, 68, 68, 0.15); color: #fca5a5; border: 1px solid rgba(239, 68, 68, 0.22); }
.status-pending { background: rgba(100, 116, 139, 0.15); color: var(--text-dim); border: 1px solid rgba(100, 116, 139, 0.2); }

/* Buttons */
.btn {
    padding: 10px 18px;
    border-radius: 12px;
    border: 1px solid transparent;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-fast);
    display: inline-flex;
    align-items: center;
    justify-content: center; /* Центрируем контент */
    gap: 8px;
    color: #fff;
    font-size: 0.9rem;
}

.btn-primary { background: linear-gradient(135deg, var(--accent-primary), var(--accent-info)); }
.btn-primary:hover { filter: brightness(1.2); transform: translateY(-1.5px); }
.btn-ghost { background: var(--glass-bg); border: 1px solid var(--glass-border); }
.btn-ghost:hover { background: rgba(255, 255, 255, 0.08); transform: translateY(-1.5px); }
.btn-icon { padding: 10px; border-radius: 12px; }

/* Switch Style */
.switch { position: relative; display: inline-block; width: 44px; height: 22px; cursor: pointer; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider { position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0; background: rgba(255,255,255,0.05); border: 1px solid var(--glass-border); transition: .3s; border-radius: 22px; }
.slider:before { position: absolute; content: ""; height: 14px; width: 14px; left: 3px; bottom: 3px; background: #fff; transition: .3s; border-radius: 50%; }
input:checked + .slider { background: var(--accent-secondary); border-color: var(--accent-secondary); }
input:checked + .slider:before { transform: translateX(22px); }

/* Forms & Switch */
.form-group { 
    margin-bottom: 1.5rem; 
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.form-group label { 
    display: block; 
    color: var(--text-muted); 
    font-size: 0.95rem; 
    font-weight: 500;
}

.form-group-top {
    margin-top: 0.5rem;
}

.hint-spaced {
    margin-bottom: 0.35rem;
}

.form-input, .form-select, textarea.form-input { 
    width: 100%; 
    background: rgba(0, 0, 0, 0.4) !important; 
    border: 1px solid var(--glass-border); 
    border-radius: 12px; 
    padding: 12px 16px; 
    color: #fff !important; 
    font-family: 'Inter', sans-serif;
    font-size: 1rem;
    transition: var(--transition-fast);
}

.form-input:focus { 
    outline: none; 
    border-color: var(--accent-primary); 
    background: rgba(0, 0, 0, 0.6) !important;
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.1);
}

textarea.form-input.code-editor {
    min-height: 160px;
    resize: vertical;
    font-family: 'Fira Code', monospace;
    font-size: 0.85rem;
    line-height: 1.5;
    background: #000 !important;
    border-color: rgba(255, 255, 255, 0.05);
}

.textarea-md {
    min-height: 168px;
}

.textarea-lg {
    min-height: 180px;
}

.textarea-xl {
    min-height: 220px;
}

.form-row-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    margin-bottom: 0.5rem;
}



.switch-container {
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(255, 255, 255, 0.03);
    padding: 8px 12px;
    border-radius: 12px;
    border: 1px solid var(--glass-border);
    width: fit-content;
}

.settings-list {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.setting-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    align-items: center;
    gap: 2rem;
    padding-bottom: 1.25rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}

.setting-row:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.setting-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.setting-info label {
    color: #fff;
    font-weight: 600;
    font-size: 0.95rem;
}

.setting-info .hint {
    font-size: 0.8rem;
    color: var(--text-dim);
}

.setting-control {
    display: flex;
    justify-content: flex-end;
}

.setting-control .form-input, 
.setting-control .form-select {
    margin-bottom: 0;
}

.switch-status-text {
    font-size: 0.8rem;
    color: var(--text-dim);
    font-weight: 600;
}

.modal-actions {
    display: flex;
    gap: 12px;
    margin-top: 1rem;
    padding-top: 1.5rem;
}

.modal-actions .btn {
    flex: 1;
    justify-content: center; /* Центрируем текст внутри кнопки */
    text-align: center;
    padding: 12px;
}

.form-group-inline {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 1.5rem;
    padding-top: 25px; /* Выравнивание по базовой линии инпута на правой стороне */
    min-height: 45px;
}

.form-group-inline label {
    margin-bottom: 0;
    color: var(--text-muted);
    font-size: 0.95rem;
}

/* Logs Accordion */
.log-accordion {
    max-height: 0;
    opacity: 0;
    overflow: hidden;
    visibility: hidden;
    /* Увеличиваем задержку для visibility и opacity при закрытии, чтобы max-height успел отработать */
    transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1), 
                opacity 0.4s ease, 
                visibility 0.4s step-end;
    background: rgba(0, 0, 0, 0.2);
}

.log-accordion.active {
    max-height: 2000px;
    opacity: 1;
    visibility: visible;
    transition: max-height 0.6s cubic-bezier(0.4, 0, 0.2, 1), 
                opacity 0.4s ease,
                visibility 0s step-start;
    border-top: 1px solid var(--glass-border);
    padding: 0;
}

.scraper-card.logs-open {
    border-color: rgba(139, 92, 246, 0.5);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4), 0 0 20px rgba(139, 92, 246, 0.1);
}

.proxy-runtime-panel {
    margin-bottom: 16px;
    border-radius: 22px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.06);
    background: rgba(10, 12, 18, 0.94);
}

.proxy-runtime-card {
    width: 100%;
    padding: 1.1rem 1.2rem;
    background: transparent;
}

.proxy-runtime-title {
    margin-bottom: 0.65rem;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-muted);
}

.proxy-runtime-row {
    margin-bottom: 0.35rem;
    font-size: 0.92rem;
    line-height: 1.55;
    color: var(--text-primary);
}

.proxy-runtime-label {
    color: var(--text-muted);
    font-weight: 600;
}

.proxy-runtime-sep {
    margin: 0 0.3rem;
    color: rgba(255, 255, 255, 0.22);
}

.terminal-note {
    padding: 0.9rem 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    color: var(--text-muted);
    font-size: 0.9rem;
}

.terminal-container {
    background: #000;
    padding: 1.2rem;
    border-radius: 22px;
    box-shadow: inset 0 0 30px rgba(0,0,0,0.8);
    width: 100%;
}

.terminal-body {
    max-height: calc(100vh - 450px); /* Увеличиваем запас, чтобы точно не вылезало за экран */
    min-height: 200px;
    height: auto;
    overflow-y: auto;
    font-family: 'Fira Code', 'Monaco', monospace;
    font-size: 0.8rem;
    line-height: 1.6;
    color: #e2e8f0;
}

.terminal-body div {
    min-height: 1.2rem;
    margin-bottom: 4px; /* Отступы между строками логов */
}

/* Log Actions Toolbar */
.log-toolbar {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding: 12px 1.2rem;
    background: #050505;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 0 0 22px 22px;
}

.log-toolbar.under-terminal {
    justify-content: stretch;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

.log-filter-input {
    flex: 1;
    min-width: 260px;
}

.log-lines-select {
    width: 150px;
}

.btn-subtle {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-muted);
    padding: 6px 12px;
    font-size: 0.8rem;
    border-radius: 12px;
    font-family: 'Outfit', sans-serif;
}

.btn-subtle:hover {
    background: rgba(255, 255, 255, 0.05);
    color: #fff;
    border-color: rgba(255, 255, 255, 0.2);
}

.btn-subtle i {
    width: 14px;
    height: 14px;
}

/* Modals */
.modal-overlay { 
    position: fixed; top: 0; left: 0; width: 100%; height: 100%; 
    background: rgba(0,0,0,0.85); backdrop-filter: blur(12px); 
    display: flex; align-items: center; justify-content: center; 
    z-index: 1000; opacity: 0; visibility: hidden; 
}
.modal-overlay.active { opacity: 1; visibility: visible; }
.modal-content { 
    width: 580px; 
    max-width: 95%; 
    background: #0f1117; 
    border-radius: 24px; 
    padding: 2.5rem; 
    border: 1px solid var(--glass-border);
    box-shadow: 0 30px 60px rgba(0,0,0,0.9);
    position: relative;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-content.modal-wide {
    width: min(1160px, 96vw);
}

.modal-content.modal-history {
    width: min(1380px, 97vw);
    height: min(86vh, 920px);
    display: flex;
    flex-direction: column;
}

.modal-content.modal-history #modal-body {
    flex: 1;
    min-height: 0;
    display: flex;
}

.modal-content h2,
.modal-content h3 {
    font-size: 1.5rem;
    margin-bottom: 2.5rem;
    color: #fff;
    font-weight: 700;
    text-align: center;
}

#close-modal {
    position: absolute;
    top: 1.5rem;
    right: 1.5rem;
    background: rgba(255,255,255,0.05);
    border: 1px solid var(--glass-border);
    color: #fff;
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition-fast);
}

#close-modal:hover {
    background: rgba(239, 68, 68, 0.2);
    border-color: rgba(239, 68, 68, 0.4);
    color: var(--accent-danger);
}

/* Auth Specific Styles */
.auth-form-container {
    padding: 1rem 0;
}

.auth-input-group {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    margin-top: 0.5rem;
    width: 100%;
}

.auth-input-wrapper {
    width: 100%;
    max-width: 100%;
}

.auth-btn-row {
    margin-top: 2rem;
    display: flex;
    width: 100%;
}

.auth-btn {
    width: 100%;
    padding: 14px;
    font-size: 1.1rem;
    background: linear-gradient(135deg, #6366f1 0%, #a855f7 100%);
    box-shadow: 0 10px 20px rgba(99, 102, 241, 0.3);
    border-radius: 12px;
}

.auth-btn:hover {
    box-shadow: 0 15px 30px rgba(99, 102, 241, 0.4);
}

/* Animations */
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
.fade-in { animation: fadeIn 0.4s ease forwards; }

@keyframes pageScreenFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.page-screen.fade-in {
    animation: pageScreenFadeIn 0.4s ease forwards;
}

.run-spinner { animation: spin 1s linear infinite; display: inline-block; }
@keyframes spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }


.run-history, .audit-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 14px;
}

.run-history-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 14px;
}

.run-history-title {
    font-size: 0.9rem;
    font-weight: 700;
    font-size: 1.28rem;
    color: var(--text-main);
}

.tab-btn i {
    width: 20px;
    height: 20px;
}

.run-history-modal-body {
    display: flex;
    flex-direction: column;
    gap: 0;
    height: 100%;
    max-height: none;
    overflow: hidden;
    padding: 0 22px;
}

.run-history-sticky {
    position: sticky;
    top: 0;
    z-index: 12;
    background: rgba(15, 17, 23, 0.96);
    backdrop-filter: blur(6px);
    margin-top: 0;
    padding-top: 0;
    padding-bottom: 8px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.run-history-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding-top: 8px;
}

.run-history-header {
    display: grid;
    grid-template-columns:
        minmax(180px, 220px)
        minmax(220px, 260px)
        100px
        minmax(180px, 220px)
        110px
        minmax(220px, 1fr);
    gap: 8px;
    align-items: center;
    padding: 4px 12px;
}

.run-history-header .run-col {
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-dim);
}

.run-history-line {
    display: grid;
    grid-template-columns:
        minmax(180px, 220px)
        minmax(220px, 260px)
        100px
        minmax(180px, 220px)
        110px
        minmax(220px, 1fr);
    gap: 8px;
    align-items: center;
    padding: 10px 12px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--glass-border);
    font-size: 0.86rem;
}

.run-col {
    color: var(--text-muted);
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.run-history-line .status-pill {
    justify-self: start;
}

.run-mode-short {
    text-align: center;
}

.run-error-inline {
    color: #fca5a5;
}

.run-filter-select {
    width: 230px;
    height: 56px;
    padding: 10px 14px;
    font-size: 1.02rem;
}

.run-filter-wrap {
    margin-left: auto;
    display: flex;
    align-items: center;
}

.run-filter-wrap.in-header {
    margin-left: 0;
}

.run-filter-inline {
    width: 100%;
    min-width: 180px;
    height: 44px;
    border-radius: 10px;
    background: rgba(0, 0, 0, 0.45) !important;
    border: 1px solid var(--glass-border) !important;
    box-shadow: none !important;
    color: var(--text-dim) !important;
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 0 36px 0 10px;
    line-height: 1.2;
}

.run-filter-inline:focus {
    border: 1px solid rgba(139, 92, 246, 0.45) !important;
    box-shadow: 0 0 0 2px rgba(139, 92, 246, 0.12) !important;
    outline: none;
}

.run-filter-inline option {
    background: #10131b;
    color: #d5deef;
    font-size: 0.9rem;
    text-transform: none;
}

.run-row-stale {
    border: 1px solid rgba(239, 68, 68, 0.25);
    box-shadow: inset 0 0 0 1px rgba(239, 68, 68, 0.08);
}

.run-row, .audit-row {
    padding: 12px 14px;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--glass-border);
}

.run-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 6px;
}

.run-meta, .audit-meta {
    color: var(--text-dim);
    font-size: 0.82rem;
}

.run-mode, .audit-title {
    color: var(--text-main);
    font-weight: 600;
}

.run-error {
    margin-top: 8px;
    color: #fca5a5;
    font-size: 0.82rem;
}

.run-empty {
    padding: 12px 14px;
    border-radius: 14px;
    color: var(--text-dim);
    background: rgba(255,255,255,0.02);
    border: 1px dashed rgba(255,255,255,0.08);
}

.settings-grid-two-col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.settings-panel {
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    padding: 14px;
    background: rgba(255, 255, 255, 0.02);
}

.settings-code-panel {
    display: flex;
    min-height: 100%;
}

.settings-code-editor {
    min-height: 100%;
    height: 100%;
    margin: 0;
}

.settings-subtitle {
    font-size: 1.05rem;
    margin-bottom: 10px;
}

.bot-message-section {
    margin-top: 1.35rem;
}

.bot-message-section:first-of-type {
    margin-top: 0.9rem;
}

.bot-message-section-head {
    margin-bottom: 0.85rem;
}

.bot-message-row + .bot-message-row {
    margin-top: 1rem;
}

.bot-message-card {
    display: grid;
    grid-template-rows: minmax(2.8rem, auto) minmax(3.1rem, auto) minmax(1.6rem, auto) minmax(202px, 1fr);
    height: 100%;
    margin-top: 0;
}

.bot-message-label {
    display: flex;
    align-items: flex-start;
    min-height: 2.8rem;
    line-height: 1.4;
}

.bot-message-usage {
    min-height: 3.1rem;
    line-height: 1.45;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.bot-message-placeholders {
    min-height: 1.6rem;
    line-height: 1.35;
}

.bot-message-textarea {
    min-height: 202px;
    max-height: 202px;
    height: 202px;
    resize: none;
}

.compact-list {
    gap: 10px;
}

.compact-row {
    grid-template-columns: 1fr 220px;
    gap: 12px;
    padding-bottom: 10px;
}

.settings-inline-actions {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 8px;
}

.sticky-actions {
    position: sticky;
    bottom: 0;
    background: transparent;
    padding: 14px 0 0 0;
    margin-top: 14px;
}

.gateway-card {
    background: rgba(255, 255, 255, 0.02);
    padding: 1.2rem;
    border-radius: 22px;
    border: 1px solid var(--glass-border);
}

.gateway-title {
    margin-bottom: 1rem;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    padding-bottom: 0.8rem;
    justify-content: space-between;
}

.gateway-title-left {
    display: flex;
    align-items: center;
    gap: 0.8rem;
}

.gateway-title-icon {
    width: 20px;
    height: 20px;
}

.gateway-title-icon-yookassa { color: #6366f1; }
.gateway-title-icon-yoomoney { color: #8b5cf6; }
.gateway-title-icon-robokassa { color: #ec4899; }
.gateway-title-icon-cryptopay { color: #10b981; }
.gateway-title-icon-stars { color: #f59e0b; }

.unified-gateway-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.plan-card-compact {
    padding: 1rem 1rem 1.05rem;
    background: rgba(255, 255, 255, 0.02);
    border-radius: 22px;
    border: 1px solid var(--glass-border);
    min-width: 0;
}

.plan-card-compact h4 {
    margin-bottom: 0;
    padding-bottom: 0.7rem;
    font-size: 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.plan-card-compact-body {
    display: grid;
    grid-template-columns: minmax(168px, 0.95fr) minmax(132px, 0.8fr) minmax(300px, 1.55fr);
    column-gap: 16px;
    row-gap: 8px;
    align-items: center;
}

.plan-grid-label {
    min-height: 36px;
    display: grid;
    align-items: center;
    font-size: 0.84rem;
    color: var(--text-muted);
    font-weight: 600;
}

.plan-grid-value {
    min-width: 0;
    min-height: 36px;
    display: flex;
    align-items: center;
}

.plan-grid-value .form-input {
    width: 100%;
}

.plan-grid-value-toggle {
    justify-content: flex-start;
}

.plan-grid-value-toggle .switch {
    margin-left: 0;
}

.plan-desc-column {
    grid-column: 3;
    grid-row: 1 / span 8;
    align-self: stretch;
    min-width: 0;
}

.plan-desc-column .plan-desc-input {
    height: 100%;
    min-height: 132px;
    line-height: 1.25;
    overflow: hidden;
    resize: none;
}

.plan-card-compact .form-group {
    gap: 6px;
    margin-bottom: 0.45rem;
}

.plan-kv-input {
    min-height: 36px !important;
    height: 36px;
    padding: 6px 9px !important;
    font-size: 0.92rem !important;
}

.plan-card-compact .form-input {
    min-height: 40px;
    padding: 8px 10px;
    font-size: 0.94rem;
}

.log-center-section {
    gap: 1rem;
}

.log-preset-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.log-preset-group {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.log-preset-btn {
    min-width: 0;
    height: 38px;
    padding: 0 14px;
    border-radius: 999px;
    color: var(--text-muted);
}

.log-preset-btn.active {
    background: rgba(59, 130, 246, 0.16);
    border-color: rgba(59, 130, 246, 0.32);
    color: #dbeafe;
}

.log-center-toolbar {
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: stretch;
    padding: 6px 0 2px 0;
}

.log-toolbar-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: flex-end;
}

.log-center-toolbar.is-compact .log-advanced {
    display: none;
}

.log-filter-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
    min-width: 0;
}

.log-filter-group.is-hidden {
    display: none;
}

.log-filter-period { flex: 0 1 180px; }
.log-filter-custom-range { flex: 2 1 420px; }
.log-filter-level { flex: 0 1 220px; }
.log-filter-source { flex: 0 1 220px; }
.log-filter-search { flex: 1 1 320px; }

.log-filter-lines { flex: 0 1 140px; }
.log-filter-order { flex: 0 1 240px; }
.log-filter-live { flex: 0 1 230px; }

.log-filter-group label {
    font-size: 0.72rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-dim);
    font-weight: 700;
}

.log-filter-search input {
    width: 100%;
}

.log-filter-custom-range .log-custom-range-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(170px, 1fr));
    gap: 8px;
}

.log-filter-live .log-live-controls {
    display: grid;
    grid-template-columns: 52px 1fr;
    gap: 8px;
    align-items: center;
}

.log-actions-group {
    display: flex;
    gap: 8px;
    align-items: center;
    justify-content: flex-end;
    min-width: 0;
    flex-wrap: wrap;
    margin-left: auto;
    flex: 0 1 auto;
}

.log-actions-group .btn {
    min-width: 132px;
    height: 44px;
}

.log-main-actions {
    margin-left: auto;
    flex: 0 0 auto;
    flex-wrap: nowrap;
}

.log-main-actions .log-icon-btn {
    width: 50px;
    min-width: 50px;
    height: 44px;
    padding: 0;
    border-radius: 12px;
}

.log-main-actions .log-icon-btn i {
    width: 20px;
    height: 20px;
}

.log-toolbar-row-main {
    align-items: flex-end;
}

.log-toolbar-row-controls {
    align-items: flex-end;
}

.log-center-results {
    border: 1px solid var(--glass-border);
    border-radius: 18px;
    background: linear-gradient(180deg, rgba(7, 10, 18, 0.94), rgba(4, 6, 12, 0.96));
    padding: 14px;
    max-height: calc(100vh - 285px);
    overflow: auto;
    font-family: 'Fira Code', monospace;
    font-size: 0.82rem;
}

.log-entry {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 12px 4px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    border-left: 3px solid transparent;
    transition: background 0.18s ease, border-color 0.18s ease;
}

.log-entry:hover {
    background: rgba(255, 255, 255, 0.02);
}

.log-entry:last-child {
    border-bottom: none;
}

.log-entry-info { border-left-color: rgba(96, 165, 250, 0.55); }
.log-entry-active { border-left-color: rgba(34, 211, 238, 0.62); }
.log-entry-success { border-left-color: rgba(74, 222, 128, 0.62); }
.log-entry-warning { border-left-color: rgba(251, 191, 36, 0.62); }
.log-entry-error { border-left-color: rgba(248, 113, 113, 0.68); }

.log-entry-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

.log-entry-ts {
    margin-left: auto;
    color: #94a3b8;
}

.log-entry-source,
.log-entry-component,
.log-entry-event,
.log-entry-run {
    padding: 3px 8px;
    border-radius: 999px;
    background: rgba(148, 163, 184, 0.1);
    color: #cbd5e1;
    font-size: 0.74rem;
}

.log-entry-event {
    font-weight: 700;
    letter-spacing: 0.03em;
}

.log-entry-message {
    color: #dce5f4;
    white-space: pre-wrap;
    word-break: break-word;
    line-height: 1.55;
}

.log-entry-context {
    color: #90a3be;
    white-space: pre-wrap;
    word-break: break-word;
    line-height: 1.5;
    font-size: 0.77rem;
}

.log-center-level {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 84px;
    padding: 4px 8px;
    border-radius: 999px;
    font-weight: 700;
    font-size: 0.74rem;
    letter-spacing: 0.04em;
    background: rgba(148, 163, 184, 0.14);
}

.level-debug { color: #9ca3af; }
.level-info { color: #60a5fa; }
.level-warning { color: #fbbf24; }
.level-error { color: #f87171; }
.level-critical { color: #ef4444; }

.tone-info {
    background: rgba(96, 165, 250, 0.12);
    color: #93c5fd;
}

.tone-active {
    background: rgba(34, 211, 238, 0.12);
    color: #67e8f9;
}

.tone-success {
    background: rgba(74, 222, 128, 0.12);
    color: #86efac;
}

.tone-warning {
    background: rgba(251, 191, 36, 0.12);
    color: #fcd34d;
}

.tone-error {
    background: rgba(248, 113, 113, 0.12);
    color: #fca5a5;
}

.source-log-meta {
    margin-bottom: 12px;
}

.source-log-results {
    max-height: calc(100vh - 390px);
}

@media (max-width: 1200px) {
    .settings-grid-two-col {
        grid-template-columns: 1fr;
    }
    .log-actions-group {
        justify-content: flex-start;
        margin-left: 0;
        flex: 1 1 100%;
    }
    .run-history-line {
        grid-template-columns: 1fr;
    }
    .save-settings-btn {
        min-width: 280px !important;
        font-size: 1.6rem;
    }
    .pricing-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    .plan-card-compact-body {
        grid-template-columns: minmax(160px, 0.95fr) minmax(132px, 0.8fr);
    }
    .plan-desc-column {
        grid-column: 1 / -1;
        grid-row: auto;
        margin-top: 6px;
    }
    .plan-desc-column .plan-desc-input {
        min-height: 112px;
    }
}

@media (max-width: 900px) {
    .log-toolbar-row {
        flex-direction: column;
        align-items: stretch;
    }
    .log-filter-period,
    .log-filter-custom-range,
    .log-filter-level,
    .log-filter-source,
    .log-filter-search,
    .log-filter-lines,
    .log-filter-order,
    .log-filter-live {
        flex: 1 1 auto;
        width: 100%;
    }
    .log-filter-custom-range .log-custom-range-grid {
        grid-template-columns: 1fr;
    }
    .log-actions-group {
        width: 100%;
        justify-content: flex-start;
    }
    .log-main-actions {
        width: 100%;
        margin-left: 0;
    }
    .log-preset-bar {
        align-items: flex-start;
    }
    .log-entry-head {
        align-items: flex-start;
    }
    .log-entry-ts {
        width: 100%;
        margin-left: 0;
    }
}

@media (max-width: 900px) {
    .pricing-grid {
        grid-template-columns: 1fr;
    }
    .plan-card-compact-body {
        grid-template-columns: 1fr;
        row-gap: 6px;
    }
    .plan-grid-label,
    .plan-grid-value {
        min-height: auto;
    }
    .plan-grid-value {
        margin-bottom: 2px;
    }
    .plan-desc-column {
        margin-top: 8px;
    }
}

/* Phase 1 shell overrides */
.app-shell {
    position: relative;
    min-height: 100vh;
    background:
        radial-gradient(circle at top right, rgba(59, 130, 246, 0.08), transparent 30%),
        radial-gradient(circle at bottom left, rgba(16, 185, 129, 0.05), transparent 35%),
        var(--bg-main);
}

.sidebar-mobile-toggle {
    position: fixed;
    top: 18px;
    left: 18px;
    z-index: 160;
    display: none;
}

.app-overlay {
    position: fixed;
    inset: 0;
    background: rgba(2, 6, 23, 0.72);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s ease;
    z-index: 120;
}

.app-overlay.active {
    opacity: 1;
    visibility: visible;
}

.app-drawer {
    position: fixed;
    top: 0;
    right: 0;
    width: min(32vw, 460px);
    height: 100vh;
    background: rgba(8, 11, 18, 0.92);
    border-left: 1px solid rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(20px);
    transform: translateX(100%);
    transition: transform 0.25s ease;
    z-index: 130;
}

.app-drawer.active {
    transform: translateX(0);
}

.drawer-panel {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.drawer-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    padding: 22px 22px 18px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}

.drawer-body {
    flex: 1;
    overflow: auto;
    padding: 20px 22px 28px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.drawer-meta-card {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 16px;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.06);
}

.drawer-meta-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    color: var(--text-muted);
}

.drawer-meta-row strong {
    color: #fff;
    text-align: right;
}

.drawer-meta-spacer {
    height: 10px;
}

.drawer-section {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.drawer-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.drawer-list-row {
    padding: 12px 14px;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.025);
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.drawer-list-title {
    color: #fff;
    font-weight: 600;
}

.drawer-list-meta {
    color: var(--text-dim);
    font-size: 0.84rem;
    margin-top: 4px;
}

.drawer-code-block {
    margin: 0;
    padding: 14px;
    border-radius: 14px;
    background: rgba(0, 0, 0, 0.34);
    border: 1px solid rgba(255, 255, 255, 0.06);
    color: #dce5f4;
    font-size: 0.8rem;
    line-height: 1.55;
    overflow: auto;
}

.page-loading {
    min-height: 40vh;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    color: var(--text-muted);
}

.page-screen {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.page-header-actions {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.page-subnav {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(0, 1fr));
    gap: 10px;
    padding: 8px;
    position: sticky;
    top: 0;
    z-index: 30;
    background: rgba(255, 255, 255, 0.025);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 18px;
    align-items: stretch;
    backdrop-filter: blur(14px);
}

.page-tab-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    min-height: 42px;
    padding: 0 14px;
    border-radius: 12px;
    border: 1px solid transparent;
    background: transparent;
    color: var(--text-dim);
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-fast);
    min-width: 0;
}

select.form-input,
select.form-select {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    border-radius: 14px;
}

.page-tab-btn:hover {
    background: rgba(255, 255, 255, 0.05);
    color: #fff;
}

.page-tab-btn.active {
    background: rgba(59, 130, 246, 0.12);
    color: #bfdbfe;
    border-color: rgba(59, 130, 246, 0.24);
}

.page-tab-btn i {
    width: 16px;
    height: 16px;
}

.page-body {
    min-width: 0;
}

.section-card {
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: var(--ui-card-padding);
    border-radius: var(--ui-card-radius);
    border: 1px solid rgba(255, 255, 255, 0.07);
    background: linear-gradient(180deg, rgba(14, 18, 27, 0.84), rgba(10, 14, 22, 0.92));
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.24);
    overflow: hidden;
}

.source-main-panel,
.mapping-content,
.source-analytics-card,
.settings-section {
    padding: var(--ui-card-padding);
    border-radius: var(--ui-card-radius);
}

.section-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
}

.section-kicker {
    margin-bottom: 8px;
    font-size: 0.72rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--text-dim);
    font-weight: 700;
}

.section-heading {
    margin: 0;
    color: #fff;
    font-size: 1.12rem;
    line-height: 1.2;
}

.metrics-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
}

.metrics-grid-cols-3 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.metrics-grid-cols-4 {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.metrics-grid-cols-6 {
    grid-template-columns: repeat(6, minmax(0, 1fr));
}

.audience-users-metrics-grid {
    grid-template-columns: repeat(6, minmax(0, 1fr));
}

.sources-metrics-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.metric-card {
    padding: 14px 16px;
    border-radius: 18px;
    border: 1px solid rgba(255, 255, 255, 0.07);
    background: rgba(12, 17, 25, 0.82);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    text-align: center;
}

.metric-info {
    border-color: rgba(59, 130, 246, 0.16);
}

.metric-success {
    border-color: rgba(16, 185, 129, 0.16);
}

.metric-error {
    border-color: rgba(239, 68, 68, 0.16);
}

.metric-warning {
    border-color: rgba(245, 158, 11, 0.18);
}

.metric-label {
    font-size: 0.76rem;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 700;
    line-height: 1.15;
    width: 100%;
}

.metric-value {
    font-family: 'Outfit', sans-serif;
    font-size: clamp(1.6rem, 1.9vw, 2.05rem);
    color: #fff;
    line-height: 1;
}

.metric-hint {
    color: var(--text-muted);
    line-height: 1.28;
    font-size: 0.86rem;
    width: 100%;
}

.admin-toolbar {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    min-height: 58px;
    padding-top: 8px;
    padding-bottom: 8px;
}

.admin-toolbar-fields {
    flex: 1 1 auto;
    min-width: 0;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
    align-items: center;
}

.admin-toolbar-field {
    min-width: 0;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
    gap: 12px;
}

.admin-toolbar-field-wide {
    grid-column: span 2;
}

.admin-toolbar-label {
    margin: 0;
    color: var(--text-muted);
    font-size: 0.95rem;
    font-weight: 600;
    white-space: nowrap;
}

.admin-toolbar-control {
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.admin-toolbar-control .form-input,
.admin-toolbar-control .form-select,
.admin-toolbar-control .btn {
    margin: 0;
    min-height: 46px;
}

.admin-toolbar-actions {
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    flex-shrink: 0;
}

.admin-toolbar-actions .btn {
    min-height: 46px;
}

.audience-filter-toolbar,
.support-filter-toolbar {
    margin-bottom: 18px;
    min-height: 46px;
    padding: 0;
}

.audience-filter-toolbar .admin-toolbar-fields {
    grid-template-columns: repeat(4, minmax(180px, 1fr)) minmax(280px, 1.35fr);
}

.support-filter-toolbar .admin-toolbar-fields {
    grid-template-columns: minmax(220px, 320px);
}

.overview-stack {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.overview-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 20px;
}

.overview-status-list,
.overview-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.overview-status-row,
.overview-list-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 16px;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.025);
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.sources-table-row,
.campaigns-table-row,
.audit-table-row,
.audience-table-row,
.discovery-row,
.maincat-item {
    border-radius: var(--ui-row-radius);
    padding: var(--ui-row-padding-y) var(--ui-row-padding-x);
    border: 1px solid rgba(255, 255, 255, 0.06);
    background: rgba(255, 255, 255, 0.025);
}

.overview-status-copy,
.overview-list-main {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.overview-status-title,
.overview-list-title {
    font-weight: 600;
    color: #fff;
}

.overview-status-meta,
.overview-list-meta {
    color: var(--text-dim);
    font-size: 0.84rem;
    line-height: 1.45;
}

.overview-inline-metric {
    font-family: 'Outfit', sans-serif;
    font-size: 1.3rem;
    color: #fff;
}

.content-body {
    padding: 30px;
}

.save-settings-btn {
    min-height: 46px;
    min-width: 240px !important;
    border-radius: 14px;
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: 0;
}

.save-settings-btn i {
    width: 18px;
    height: 18px;
}

.page-body .glass-card {
    background: rgba(15, 18, 26, 0.82);
    border: 1px solid rgba(255, 255, 255, 0.07);
    border-radius: 22px;
    overflow: hidden;
}

.page-body .glass-card.settings-section {
    padding: 20px;
    border-radius: 22px;
    overflow: visible;
}

.source-workspace-grid,
.mapping-screen {
    display: grid;
    grid-template-columns: minmax(260px, 320px) minmax(0, 1fr);
    gap: 20px;
}

.source-screen-stack {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.source-side-panel,
.mapping-sidebar {
    align-self: start;
    position: sticky;
    top: 0;
}

.source-main-panel,
.mapping-content {
    min-width: 0;
}

.source-screen-header-panel {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 12px;
    min-height: 58px;
    padding-top: 8px;
    padding-bottom: 8px;
}

.source-screen-controls {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
    align-items: center;
}

.source-screen-header-panel.admin-toolbar {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.source-screen-header-panel .admin-toolbar-fields {
    flex: 1 1 auto;
    min-width: 0;
}

.source-screen-header-panel .admin-toolbar-actions {
    margin-left: auto;
    flex: 0 0 auto;
    align-self: center;
    flex-wrap: nowrap;
}

.source-screen-header-panel:not(.source-screen-header-panel-logs):not(.source-screen-header-panel-settings) .admin-toolbar-fields {
    grid-template-columns: minmax(320px, 1fr) minmax(280px, 0.78fr);
}

.source-screen-header-panel-logs .admin-toolbar-fields {
    grid-template-columns: minmax(280px, 0.9fr) minmax(320px, 0.95fr) minmax(220px, 0.48fr);
}

.source-screen-header-panel-settings .admin-toolbar-fields {
    grid-template-columns: minmax(260px, 0.72fr) minmax(320px, 0.98fr);
}

.source-screen-header-panel-logs .admin-toolbar-actions .btn {
    width: 54px;
    min-width: 54px;
    padding-left: 0;
    padding-right: 0;
}

.source-screen-header-panel-settings .admin-toolbar-actions .btn {
    min-width: 170px;
}

.source-screen-summary-field .admin-toolbar-control {
    min-height: 46px;
    padding: 0 16px;
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.06);
    background: rgba(255, 255, 255, 0.035);
}

.source-screen-controls-logs {
    grid-template-columns: minmax(280px, 1.05fr) minmax(320px, 1fr) minmax(260px, 0.75fr) auto;
}

.source-screen-header-panel .form-group {
    margin-bottom: 0;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
    gap: 12px;
}

.source-screen-header-panel .form-group label {
    margin: 0;
    white-space: nowrap;
}

.source-screen-inline-summary {
    align-self: stretch;
    margin: 0;
    min-height: 46px;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    padding-top: 0;
    padding-bottom: 0;
}

.source-screen-inline-summary-text {
    color: #fff;
    font-weight: 600;
    font-size: 0.9rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.source-screen-inline-actions {
    align-self: center;
    margin: 0;
}

.source-screen-header-panel:has(.source-screen-inline-summary) {
    display: flex;
}

.source-screen-header-panel-with-actions {
    display: grid;
    grid-template-columns: minmax(320px, 1fr) auto;
    align-items: center;
    gap: 16px;
}

.source-analytics-header-metrics {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
}

.source-analytics-header-chip {
    min-height: 46px;
    padding: 0 16px;
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.06);
    background: rgba(255, 255, 255, 0.035);
    display: inline-flex;
    align-items: center;
    gap: 12px;
    white-space: nowrap;
}

.source-analytics-header-chip-status {
    padding-right: 10px;
}

.source-analytics-header-chip-label {
    color: #fff;
    font-weight: 600;
    font-size: 0.95rem;
    line-height: 1;
}

.source-analytics-header-chip-value {
    color: #fff;
    font-size: 1rem;
    font-weight: 700;
    line-height: 1;
}

.source-screen-header-panel:has(.source-screen-inline-summary) #open-taxonomy-mapping-btn {
    min-height: 46px;
    min-width: 220px;
    padding-inline: 16px;
}

.source-screen-actions {
    justify-content: flex-start;
    align-items: center;
}

.source-screen-actions-inline {
    justify-self: start;
    align-self: center;
    margin-left: 0;
    flex-wrap: nowrap;
}

.source-side-actions {
    justify-content: flex-start;
}

.source-side-actions .btn {
    min-width: 0;
}

.source-screen-select {
    min-height: 46px;
}

.source-terminal {
    min-height: 420px;
}

.source-runs-body {
    padding: 0;
}

.mapping-meta-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.sources-list-screen {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.sources-metrics-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.sources-toolbar {
    min-width: min(360px, 100%);
}

.sources-toolbar-standalone {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 18px;
}

.sources-table {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.audience-filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.setting-item {
    display: grid;
    grid-template-columns: 1fr 1fr;
    align-items: center;
    gap: 2rem;
    padding-bottom: 1.25rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}

.setting-item:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.audience-filter-bar .form-input {
    flex: 1 1 220px;
}

.audience-table {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.audience-table-header,
.audience-table-row {
    display: grid;
    grid-template-columns: minmax(200px, 1.15fr) minmax(150px, 0.9fr) repeat(4, minmax(132px, 1fr)) 60px;
    gap: 12px;
    align-items: center;
}

.audience-table-header-delivery,
.audience-table-row.audience-delivery-row,
.audience-table.delivery-table .audience-table-row {
    grid-template-columns: repeat(5, minmax(0, 1fr));
}

.audience-table-header-billing {
    grid-template-columns: minmax(220px, 1.4fr) 120px 120px 170px;
}

.audience-table-header {
    padding: 0 12px 6px;
}

.audience-table-header .sources-head-cell:first-child {
    justify-self: start;
    text-align: left;
}

.audience-table-header .sources-head-cell:nth-child(2),
.audience-table-header .sources-head-cell:nth-child(3),
.audience-table-header .sources-head-cell:nth-child(4),
.audience-table-header .sources-head-cell:nth-child(5),
.audience-table-header .sources-head-cell:nth-child(6) {
    justify-self: center;
    text-align: center;
}

.audience-table-header .sources-head-cell:last-child {
    justify-self: end;
    text-align: right;
}

.audience-table-header-delivery .sources-head-cell {
    width: 100%;
    justify-self: stretch;
}

.audience-delivery-head-batch,
.audience-delivery-head-source {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    text-align: left;
}

.audience-delivery-head-status,
.audience-delivery-head-available,
.audience-delivery-head-attempts {
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.audience-table-body {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.audience-table-row {
    padding: var(--ui-row-padding-y) var(--ui-row-padding-x);
}

.audience-cell {
    min-width: 0;
}

.audience-cell-profession,
.audience-cell-plan,
.audience-cell-status,
.audience-cell-subscriptions,
.audience-cell-created {
    justify-self: center;
    text-align: center;
}

.audience-delivery-cell-status,
.audience-delivery-cell-available,
.audience-delivery-cell-attempts {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    justify-self: stretch;
    text-align: center;
}

.audience-delivery-cell-batch,
.audience-delivery-cell-source {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    justify-self: stretch;
    text-align: left;
    width: 100%;
    overflow: hidden;
}

.audience-delivery-cell-status .status-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-width: 0;
    max-width: 180px;
    text-align: center;
}

.audience-delivery-cell-batch .sources-primary,
.audience-delivery-cell-source .sources-primary {
    display: block;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.audience-delivery-cell-batch .sources-secondary,
.audience-delivery-cell-source .sources-secondary {
    display: block;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.audience-delivery-cell-attempts {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.audience-delivery-cell-attempts .sources-primary {
    line-height: 1;
}

.audience-delivery-cell-batch .sources-secondary,
.audience-delivery-cell-source .sources-secondary,
.audience-delivery-cell-available .sources-secondary,
.audience-delivery-cell-attempts .sources-secondary {
    font-size: 0.9rem;
    line-height: 1.3;
    overflow-wrap: anywhere;
}

.audience-cell-profession {
    width: 100%;
}

.audience-profession-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
    width: 100%;
}

.audience-profession-item {
    color: var(--text-muted);
    font-size: 0.9rem;
    line-height: 1.25;
}

.audience-cell-plan,
.audience-cell-status {
    justify-self: stretch;
    display: flex;
    justify-content: center;
}

.audience-cell-actions {
    justify-self: end;
}

.audience-cell-user .sources-primary {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.audience-cell-user .sources-secondary,
.audience-cell-created .sources-secondary,
.audience-cell-subscriptions .sources-secondary {
    overflow-wrap: anywhere;
}

.audience-cell-plan .status-pill,
.audience-cell-status .status-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-width: 0;
    max-width: 148px;
    text-align: center;
}

.audience-cell-subscriptions {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.audience-cell-subscriptions .sources-primary {
    line-height: 1;
}

.audience-cell-subscriptions .sources-secondary,
.audience-cell-created .sources-secondary {
    font-size: 0.9rem;
    line-height: 1.3;
}

.support-table .audience-table-header,
.support-table .support-table-row {
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 12px;
}

.support-table .sources-head-cell:first-child,
.support-table .sources-head-cell:nth-child(2),
.support-table .sources-head-cell:nth-child(5) {
    justify-self: start;
    text-align: left;
}

.support-table .sources-head-cell:nth-child(3),
.support-table .sources-head-cell:nth-child(4) {
    justify-self: center;
    text-align: center;
}

.support-table .sources-head-cell:last-child {
    justify-self: end;
    text-align: right;
}

.support-table .audience-cell-plan,
.support-table .audience-cell-status {
    justify-self: stretch;
}

.support-table .support-cell-message {
    align-self: center;
}

.support-table .support-cell-message .sources-secondary {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.support-table .support-cell-actions {
    display: flex;
    justify-content: center;
    align-items: center;
    justify-self: stretch;
}

.support-table .support-detail-btn {
    width: 48px;
    min-width: 48px;
    height: 48px;
    padding: 0;
    border-radius: 14px;
}

@media (max-width: 1520px) {
    .support-table .audience-table-header,
    .support-table .support-table-row {
        grid-template-columns: repeat(6, minmax(0, 1fr));
        gap: 10px;
    }
}

@media (max-width: 1220px) {
    .support-table .audience-table-header,
    .support-table .support-table-row {
        grid-template-columns: minmax(132px, 0.8fr) minmax(180px, 1fr) 112px 124px minmax(0, 1fr);
    }

    .support-table .sources-head-cell:nth-child(5) {
        grid-column: 1 / 4;
    }

    .support-table .sources-head-cell:nth-child(6) {
        grid-column: 4 / 6;
    }

    .support-table .support-cell-message {
        grid-column: 1 / 4;
    }

    .support-table .support-cell-actions {
        grid-column: 4 / 6;
    }
}

@media (max-width: 900px) {
    .support-table .support-table-row {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 14px 16px;
        padding: 16px;
    }

    .support-table .audience-cell,
    .support-table .support-cell-actions {
        justify-self: stretch;
        text-align: left;
    }

    .support-table .audience-cell-plan,
    .support-table .audience-cell-status {
        display: flex;
        flex-direction: column;
        align-items: flex-start;
        justify-content: flex-start;
    }

    .support-table .audience-cell-plan .status-pill,
    .support-table .audience-cell-status .status-pill {
        max-width: none;
    }

    .support-table .support-cell-message,
    .support-table .support-cell-actions {
        grid-column: 1 / -1;
    }

    .support-table .support-cell-message .sources-secondary {
        white-space: normal;
        overflow: visible;
        text-overflow: clip;
    }

    .support-table .support-cell-actions {
        justify-content: flex-start;
    }

    .support-table .support-detail-btn {
        width: 100%;
    }
}

@media (max-width: 640px) {
    .support-table .support-table-row {
        grid-template-columns: 1fr;
    }

    .support-table .support-cell-message,
    .support-table .support-cell-actions {
        grid-column: auto;
    }
}

.audience-detail-btn {
    width: 44px;
    height: 44px;
    min-width: 44px;
    justify-content: center;
    padding: 0;
}

@media (max-width: 1680px) {
    .audience-table-header,
    .audience-table-row {
        grid-template-columns: minmax(180px, 1.05fr) minmax(136px, 0.85fr) repeat(4, minmax(124px, 1fr)) 56px;
        gap: 10px;
    }

    .audience-table-header-delivery,
    .audience-table-row.audience-delivery-row,
    .audience-table.delivery-table .audience-table-row {
        grid-template-columns: repeat(5, minmax(0, 1fr));
        gap: 10px;
    }
}

@media (max-width: 1440px) {
    .audience-table-header,
    .audience-table-row {
        grid-template-columns: minmax(180px, 1fr) minmax(136px, 0.85fr) repeat(3, minmax(116px, 1fr)) 1fr;
    }

    .audience-table-header .sources-head-cell:nth-child(6) {
        grid-column: 5 / 6;
    }

    .audience-table-header .sources-head-cell:nth-child(7) {
        grid-column: 6 / 7;
    }

    .audience-cell-created {
        grid-column: 5 / 6;
    }

    .audience-cell-actions {
        grid-column: 6 / 7;
    }

    .audience-table-header-delivery,
    .audience-table-row.audience-delivery-row,
    .audience-table.delivery-table .audience-table-row {
        grid-template-columns: repeat(5, minmax(0, 1fr));
        gap: 10px;
    }
}

.campaign-builder-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.35fr) minmax(320px, 0.85fr);
    gap: 20px;
    align-items: start;
}

.campaign-builder-side {
    position: sticky;
    top: 0;
}

.campaign-builder-form,
.campaign-builder-section {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.campaign-form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.campaign-field-span-2 {
    grid-column: span 2;
}

.campaign-option-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
}

.campaign-option-grid.compact-grid {
    grid-template-columns: repeat(3, minmax(120px, 1fr));
}

.campaign-option-chip {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-height: 86px;
    padding: 14px 16px;
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.07);
    background: rgba(255, 255, 255, 0.025);
    cursor: pointer;
    transition: var(--transition-fast);
}

.campaign-option-chip:hover {
    border-color: rgba(59, 130, 246, 0.26);
    background: rgba(59, 130, 246, 0.08);
}

.campaign-option-chip.is-selected {
    border-color: rgba(59, 130, 246, 0.3);
    background: rgba(59, 130, 246, 0.1);
}

.campaign-option-chip input {
    margin: 0;
}

.campaign-option-main {
    color: #fff;
    font-weight: 600;
    line-height: 1.3;
}

.campaign-option-meta {
    color: var(--text-dim);
    font-size: 0.82rem;
    line-height: 1.45;
}

.campaign-flags-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.campaign-flag-toggle {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 16px;
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.07);
    background: rgba(255, 255, 255, 0.025);
}

.campaign-flag-toggle input {
    margin-top: 3px;
}

.campaign-flag-toggle strong {
    display: block;
    color: #fff;
    line-height: 1.3;
}

.campaign-flag-toggle small {
    display: block;
    margin-top: 6px;
    color: var(--text-dim);
    line-height: 1.45;
}

.campaign-actions-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    align-items: end;
    justify-content: space-between;
    padding-top: 6px;
}

.campaign-schedule-control {
    min-width: min(320px, 100%);
}

.campaign-form-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: flex-end;
}

.support-drawer-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.support-drawer-actions .btn {
    width: 100%;
    min-height: 56px;
    justify-content: center;
    padding: 0 18px;
}

.support-drawer-actions .btn i {
    flex-shrink: 0;
}

@media (max-width: 640px) {
    .support-drawer-actions {
        grid-template-columns: 1fr;
    }
}

.campaign-preview-metrics {
    gap: 12px;
}

.campaigns-table {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.campaigns-table-header,
.campaigns-table-row {
    display: grid;
    grid-template-columns: minmax(240px, 1.45fr) 110px 140px 170px minmax(180px, 1fr) minmax(210px, 1fr);
    gap: 12px;
    align-items: center;
}

.campaigns-table-header {
    padding: 0 12px 6px;
}

.campaigns-table-body {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.campaigns-table-row {
    padding: var(--ui-row-padding-y) var(--ui-row-padding-x);
}

.campaigns-cell {
    min-width: 0;
}

.campaigns-actions-cell {
    justify-self: stretch;
}

.campaign-row-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.status-banner {
    padding: 14px 16px;
    border-radius: 16px;
    border: 1px solid rgba(59, 130, 246, 0.18);
    background: rgba(59, 130, 246, 0.08);
    color: #dbeafe;
    line-height: 1.55;
}

.status-banner-success {
    border-color: rgba(16, 185, 129, 0.2);
    background: rgba(16, 185, 129, 0.08);
    color: #d1fae5;
}

.status-banner-info {
    border-color: rgba(59, 130, 246, 0.18);
    background: rgba(59, 130, 246, 0.08);
    color: #dbeafe;
}

.discovery-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.discovery-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 20px;
    align-items: center;
    padding: var(--ui-row-padding-y) var(--ui-row-padding-x);
    min-height: 72px;
}

.discovery-row-main {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    gap: 8px;
    min-width: 0;
}

.discovery-row-title {
    color: #fff;
    font-weight: 700;
    line-height: 1.2;
    width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.discovery-row-meta {
    width: 100%;
    color: var(--text-dim);
    font-size: 0.84rem;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.discovery-row-actions {
    display: grid;
    grid-template-columns: minmax(220px, 260px) 54px 54px;
    gap: 10px;
    justify-content: end;
    align-items: center;
    flex-shrink: 0;
}

.discovery-row-actions .form-input,
.discovery-row-actions .btn {
    width: 100%;
    height: 44px;
    min-height: 44px;
}

.discovery-row-actions .form-input {
    padding-top: 8px;
    padding-bottom: 8px;
    font-size: 0.96rem;
}

.discovery-row-actions .btn-icon {
    padding: 0;
    width: 54px;
    min-width: 54px;
}

.sources-table-header,
.sources-table-row {
    display: grid;
    grid-template-columns: minmax(260px, 1.15fr) 96px 132px 208px minmax(180px, 0.9fr) 208px;
    gap: 12px;
    align-items: center;
}

.sources-table-header {
    padding: 0 12px 6px;
}

.sources-head-cell {
    font-size: 0.72rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-dim);
    font-weight: 700;
    line-height: 1.15;
    align-self: end;
}

.sources-head-cell:first-child {
    justify-self: start;
    text-align: left;
}

.sources-head-cell:nth-child(2),
.sources-head-cell:nth-child(3),
.sources-head-cell:nth-child(4),
.sources-head-cell:nth-child(5) {
    justify-self: center;
    text-align: center;
}

.sources-head-cell:last-child {
    justify-self: end;
    text-align: right;
}

.sources-table-body {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.sources-table-row {
    padding: 10px 12px;
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.06);
    background: rgba(255, 255, 255, 0.025);
}

.sources-cell {
    min-width: 0;
}

.sources-cell-toggle,
.sources-cell-last-run,
.sources-cell-status,
.sources-cell-runtime {
    justify-self: center;
    text-align: center;
}

.sources-cell-actions {
    justify-self: end;
}

.sources-source-line {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    min-width: 0;
}

.sources-source-main {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    min-width: 0;
}

.sources-source-stats {
    width: 100%;
}

.sources-primary {
    color: #fff;
    font-weight: 600;
    line-height: 1.2;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sources-secondary {
    color: var(--text-dim);
    font-size: 0.8rem;
    line-height: 1.25;
}

.sources-type-chip {
    display: inline-flex;
    align-items: center;
    padding: 3px 8px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: var(--text-dim);
    font-size: 0.74rem;
    line-height: 1;
    white-space: nowrap;
}

.sources-stats-inline {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    min-width: 0;
}

.sources-stat-chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 7px;
    border-radius: 999px;
    background: rgba(59, 130, 246, 0.08);
    border: 1px solid rgba(59, 130, 246, 0.12);
    color: #bfdbfe;
    font-size: 0.72rem;
    line-height: 1;
}

.sources-stat-chip strong {
    color: #fff;
    font-size: 0.68rem;
    letter-spacing: 0.04em;
}

.sources-toggle-wrap {
    display: inline-flex;
    align-items: center;
}

.sources-cell-actions .scraper-actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 8px;
}

.sources-cell-actions .btn-icon {
    width: 38px;
    height: 38px;
    border-radius: 14px;
}

.sources-cell-status {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}

.sources-cell-status .status-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 168px;
    text-align: center;
}

.sources-cell-toggle .switch {
    transform: scale(0.94);
    transform-origin: center;
}

.sources-mobile-label {
    display: none;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-dim);
    margin-bottom: 6px;
    font-weight: 700;
}

@media (max-width: 1680px) {
    .sources-table-header,
    .sources-table-row {
        grid-template-columns: minmax(240px, 1fr) 92px 124px 192px minmax(160px, 0.82fr) 196px;
        gap: 10px;
    }
}

@media (max-width: 1440px) {
    .sources-table-header,
    .sources-table-row {
        grid-template-columns: minmax(220px, 1fr) 88px 116px 184px 1fr;
    }

    .sources-head-cell:nth-child(5) {
        grid-column: 1 / 3;
    }

    .sources-head-cell:nth-child(6) {
        grid-column: 3 / 6;
    }

    .sources-cell-runtime {
        grid-column: 1 / 3;
    }

    .sources-cell-actions {
        grid-column: 3 / 6;
    }
}

@media (max-width: 1180px) {
    .sources-table-header,
    .sources-table-row {
        grid-template-columns: minmax(0, 1fr) 88px 112px 124px;
    }

    .sources-head-cell:nth-child(5) {
        grid-column: 1 / 3;
    }

    .sources-head-cell:nth-child(6) {
        grid-column: 3 / 5;
    }

    .sources-cell-runtime {
        grid-column: 1 / 3;
    }

    .sources-cell-actions {
        grid-column: 3 / 5;
    }
}


.sources-analytics-screen {
    align-items: stretch;
}

.sources-analytics-toolbar {
    justify-content: flex-end;
}

.sources-analytics-sort {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 240px;
    color: var(--text-muted);
    font-size: 0.82rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.source-analytics-stack {
    display: grid;
    gap: 16px;
}

.source-analytics-card-header {
    align-items: flex-start;
    justify-content: flex-end;
    gap: 16px;
}

.source-analytics-card-meta {
    color: var(--text-muted);
    font-size: 0.95rem;
}

.source-analytics-total-pill {
    display: inline-flex;
    flex-direction: column;
    gap: 4px;
    padding: 12px 16px;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.06);
    min-width: 160px;
}

.source-analytics-total-pill span {
    color: var(--text-dim);
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.source-analytics-total-pill strong {
    color: #fff;
    font-size: 1.5rem;
    font-weight: 700;
}

.source-analytics-kpis {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
}

.source-analytics-kpi {
    padding: 16px 18px;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.source-analytics-kpi-label {
    color: var(--text-dim);
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-weight: 700;
}

.source-analytics-kpi-value {
    color: #fff;
    font-size: 1.8rem;
    font-weight: 700;
    line-height: 1;
}

.source-analytics-kpi-hint {
    color: var(--text-muted);
    font-size: 0.94rem;
}

.source-analytics-panels {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.source-analytics-panel {
    min-width: 0;
}

.source-analytics-panel-title {
    margin: 6px 0 0;
    font-size: 1.05rem;
    color: #fff;
}

.source-analytics-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 14px;
}

.source-analytics-item {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: flex-start;
    padding: 12px 14px;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.source-analytics-item-copy {
    min-width: 0;
}

.source-analytics-item-title {
    color: #fff;
    font-weight: 600;
}

.source-analytics-item-meta {
    margin-top: 4px;
    color: var(--text-muted);
    font-size: 0.92rem;
}

.source-analytics-item-value-block {
    text-align: right;
    flex-shrink: 0;
}

.source-analytics-item-value {
    color: #fff;
    font-weight: 700;
    font-size: 1.02rem;
}

.source-analytics-item-subvalue {
    margin-top: 4px;
    color: var(--text-dim);
    font-size: 0.9rem;
}

.source-analytics-empty {
    padding: 20px;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px dashed rgba(255, 255, 255, 0.08);
    color: var(--text-muted);
}

.audit-table {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.audit-table-header,
.audit-table-row {
    display: grid;
    grid-template-columns: 140px minmax(220px, 1fr) 160px 140px;
    gap: 12px;
    align-items: center;
}

.audit-table-header {
    padding: 0 12px 6px;
}

.audit-table-header .audit-cell {
    font-size: 0.72rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-dim);
    font-weight: 700;
}

.audit-table-row {
    padding: 14px 12px;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.audit-cell {
    min-width: 0;
    color: var(--text-muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.audit-cell-action {
    color: #fff;
    font-weight: 600;
}

body.no-auth .sidebar-mobile-toggle,
body.no-auth .app-overlay,
body.no-auth .app-drawer {
    display: none !important;
}

@media (max-width: 1280px) {
    .metrics-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .metrics-grid-cols-6 {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .metrics-grid-cols-4 {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .metrics-grid-cols-3 {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 1100px) {
    .sidebar-mobile-toggle {
        display: inline-flex;
    }

    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        height: 100vh;
        transform: translateX(-100%);
        transition: transform 0.25s ease;
        z-index: 140;
        box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
    }

    .sidebar.sidebar-open {
        transform: translateX(0);
    }

    .main-wrapper {
        width: 100%;
    }

    .content-body {
        padding: 72px 18px 22px;
    }
}

@media (max-width: 900px) {
    .admin-toolbar,
    .admin-toolbar-fields,
    .admin-toolbar-field {
        display: flex;
        flex-direction: column;
        align-items: stretch;
        width: 100%;
    }

    .admin-toolbar-actions {
        width: 100%;
        justify-content: flex-start;
        flex-wrap: wrap;
    }

    .admin-toolbar-actions .btn {
        width: auto;
    }

    .source-analytics-kpis,
    .source-analytics-panels {
        grid-template-columns: 1fr;
    }

    .sources-analytics-toolbar,
    .sources-analytics-sort {
        width: 100%;
    }

    .source-analytics-item {
        flex-direction: column;
    }

    .source-analytics-item-value-block {
        text-align: left;
    }

    .page-header-actions,
    .page-header-actions .btn {
        width: 100%;
    }

    .page-subnav {
        display: flex;
        flex-wrap: nowrap;
        overflow-x: auto;
    }

    .overview-grid,
    .metrics-grid {
        grid-template-columns: 1fr;
    }

    .metrics-grid-cols-3,
    .metrics-grid-cols-4,
    .metrics-grid-cols-6 {
        grid-template-columns: 1fr;
    }

    .campaign-builder-grid,
    .campaign-form-grid,
    .campaign-option-grid,
    .campaign-flags-grid {
        grid-template-columns: 1fr;
    }

    .campaign-field-span-2 {
        grid-column: auto;
    }

    .source-workspace-grid,
    .mapping-screen {
        grid-template-columns: 1fr;
    }

    .source-screen-controls,
    .source-screen-controls-logs {
        grid-template-columns: 1fr;
    }

    .source-screen-header-panel {
        min-height: auto;
        padding-top: 20px;
        padding-bottom: 20px;
    }

    .source-screen-header-panel:has(.source-screen-inline-summary) {
        display: flex;
        grid-template-columns: none;
    }

    .source-screen-header-panel-with-actions {
        display: flex;
        grid-template-columns: none;
    }

    .source-analytics-header-metrics {
        width: 100%;
        justify-content: flex-start;
        flex-wrap: wrap;
    }

    .source-analytics-header-chip {
        min-height: 46px;
    }

    .source-screen-header-panel .form-group {
        grid-template-columns: 1fr;
        align-items: stretch;
    }

    .source-screen-inline-summary,
    .source-screen-inline-actions {
        align-self: stretch;
    }

    .source-screen-actions-inline {
        justify-self: stretch;
        flex-wrap: wrap;
    }

    .sources-metrics-grid {
        grid-template-columns: 1fr;
    }

    .sources-table-header,
    .campaigns-table-header,
    .audit-table-header,
    .audience-table-header {
        display: none;
    }

    .sources-table-row,
    .campaigns-table-row,
    .audit-table-row,
    .audience-table-row {
        grid-template-columns: 1fr;
    }

    .sources-cell-runtime,
    .sources-cell-actions {
        grid-column: auto;
    }

    .discovery-row {
        grid-template-columns: 1fr;
    }

    .discovery-row-actions {
        grid-template-columns: 1fr;
    }

    .app-drawer {
        width: min(100vw, 460px);
    }

    .sources-mobile-label {
        display: block;
    }

    .source-side-panel,
    .mapping-sidebar {
        position: static;
    }

    .overview-status-row,
    .overview-list-row {
        flex-direction: column;
        align-items: flex-start;
    }

    .campaign-form-actions,
    .campaign-form-actions .btn,
    .campaign-row-actions,
    .campaign-row-actions .btn {
        width: 100%;
    }

    .settings-save-bar .btn,
    .save-settings-btn {
        width: 100%;
        min-width: 0 !important;
    }
}







.category-analytics-screen {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.category-analytics-toolbar {
    min-height: 58px;
    padding-top: 8px;
    padding-bottom: 8px;
}

.category-analytics-toolbar .admin-toolbar-fields {
    grid-template-columns: minmax(320px, 380px);
}

.category-analytics-stack {
    display: grid;
    gap: 16px;
}

.category-analytics-card {
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 20px;
    overflow: visible;
}

.category-analytics-card-header {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 16px;
}

.category-analytics-card-header > :first-child {
    min-width: 0;
}

.category-analytics-card-copy {
    min-width: 0;
}

.category-analytics-card-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 6px;
    color: var(--text-muted);
    font-size: 0.88rem;
    line-height: 1.35;
}

.category-analytics-stats-inline {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 10px;
    min-width: 0;
}

.category-analytics-stat-chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 7px;
    border-radius: 999px;
    background: rgba(59, 130, 246, 0.08);
    border: 1px solid rgba(59, 130, 246, 0.12);
    color: #bfdbfe;
    font-size: 0.72rem;
    line-height: 1;
}

.category-analytics-stat-chip strong {
    color: #fff;
    font-size: 0.68rem;
    letter-spacing: 0.04em;
}

.category-analytics-card-aside {
    display: flex;
    align-items: center;
    gap: 10px;
    justify-self: end;
}

.category-analytics-card-aside .status-pill {
    min-height: 44px;
    padding: 0 18px;
    border-radius: 16px;
    font-size: 0.92rem;
    justify-content: center;
}

.category-analytics-total-pill {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.06);
    white-space: nowrap;
}

.category-analytics-total-pill span {
    color: var(--text-dim);
    font-size: 0.76rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.category-analytics-total-pill strong {
    color: #fff;
    font-size: 1.18rem;
    font-weight: 700;
}

.category-analytics-panels {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
}

.category-analytics-panel {
    padding: 16px;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.05);
    min-height: 100%;
}

.category-analytics-panel-title {
    margin: 0;
    font-size: 1rem;
    color: #fff;
}

.category-analytics-panel-note {
    margin-top: 8px;
    color: var(--text-muted);
    font-size: 0.88rem;
}

.category-analytics-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 12px;
}

.category-analytics-item {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: flex-start;
    padding: 12px 14px;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.category-analytics-item-copy {
    min-width: 0;
}

.category-analytics-item-title {
    color: #fff;
    font-weight: 600;
}

.category-analytics-item-meta {
    margin-top: 4px;
    color: var(--text-muted);
    font-size: 0.92rem;
}

.category-analytics-item-value-block {
    text-align: right;
    flex-shrink: 0;
}

.category-analytics-item-value {
    color: #fff;
    font-weight: 700;
    font-size: 1.02rem;
}

.category-analytics-item-subvalue {
    margin-top: 4px;
    color: var(--text-dim);
    font-size: 0.9rem;
}

.category-analytics-delivery-list {
    gap: 8px;
}

.category-analytics-delivery-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 14px;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
    color: var(--text-muted);
}

.category-analytics-delivery-item strong {
    color: #fff;
}

.category-analytics-delivery-item.tone-success strong {
    color: #7ef5b8;
}

.category-analytics-delivery-item.tone-error strong {
    color: #ff8d98;
}

.category-analytics-plan-cloud {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 14px;
}

.category-analytics-plan-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    border-radius: 999px;
    background: rgba(92, 126, 255, 0.14);
    border: 1px solid rgba(92, 126, 255, 0.24);
    color: #dce5ff;
    font-size: 0.9rem;
}

.category-analytics-plan-pill strong {
    color: #fff;
}

.category-analytics-empty {
    padding: 20px;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px dashed rgba(255, 255, 255, 0.08);
    color: var(--text-muted);
}

@media (max-width: 900px) {
    .category-analytics-panels {
        grid-template-columns: 1fr;
    }

    .category-analytics-toolbar,
    .audience-filter-toolbar,
    .support-filter-toolbar {
        width: 100%;
    }

    .category-analytics-item {
        flex-direction: column;
    }

    .category-analytics-item-value-block {
        text-align: left;
    }

    .category-analytics-card-aside {
        align-items: flex-start;
        flex-wrap: wrap;
    }
}


.security-workspace {
    display: flex;
    flex-direction: column;
    gap: 20px;
    padding-bottom: 112px;
}

.security-unified-card {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.security-config-form {
    min-width: 0;
}

.security-pane {
    min-width: 0;
}

.security-stack-divider {
    height: 1px;
    background: linear-gradient(90deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.03));
}

.security-section-copy {
    margin: -4px 0 0;
    color: var(--text-muted);
    line-height: 1.55;
}

.security-password-list {
    gap: 1rem;
    margin-top: 18px;
}

.security-password-pane .setting-control {
    justify-content: stretch;
}

.security-password-pane .setting-control .password-input-wrapper,
.security-password-pane .setting-control .form-input,
.security-password-pane .field-compact {
    width: 100%;
    max-width: none;
}

.security-password-actions {
    margin-top: 10px;
    padding-top: 18px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    display: flex;
    justify-content: flex-end;
}

.security-password-btn {
    min-width: 220px;
    min-height: 54px;
    border-radius: 14px;
    font-size: 1rem;
    font-weight: 700;
    box-shadow: 0 16px 34px rgba(59, 130, 246, 0.18);
}

@media (max-width: 760px) {
    .security-unified-card {
        gap: 22px;
    }

    .security-password-actions {
        justify-content: stretch;
    }

    .security-password-btn {
        width: 100%;
    }
}


