* {
    box-sizing: border-box;
}

/* Дизайн-штрих: выделение текста в цветах бренда */
::selection {
    background: rgba(79, 70, 229, 0.35);
    color: #111827;
}

::-moz-selection {
    background: rgba(79, 70, 229, 0.35);
    color: #111827;
}

/* Дизайн-штрих: кастомный скроллбар */
html {
    scrollbar-width: thin;
    scrollbar-color: rgba(79, 70, 229, 0.5) transparent;
}

::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(79, 70, 229, 0.35);
    border-radius: 999px;
    border: 3px solid transparent;
    background-clip: padding-box;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(79, 70, 229, 0.5);
    border: 3px solid transparent;
    background-clip: padding-box;
}

::-webkit-scrollbar-corner {
    background: transparent;
}

body {
    margin: 0;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
    background:
        radial-gradient(1200px 800px at 80% 20%, rgba(99,102,241,0.15), transparent 60%),
        radial-gradient(1000px 600px at 20% 80%, rgba(139,92,246,0.12), transparent 65%),
        radial-gradient(1400px 600px at 50% -20%, rgba(79,70,229,0.30), transparent 70%),
        radial-gradient(circle at 1px 1px, rgba(79,70,229,0.1) 1px, transparent 0),
        #ebebeb;
    background-size:
        auto,
        auto,
        auto,
        24px 24px,
        auto;
    position: relative;
    color: #111827;
}

body::before {
    content: "";
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    z-index: 0;
    background:
        radial-gradient(800px 800px at 30% 30%, rgba(99,102,241,0.08), transparent 50%),
        radial-gradient(600px 600px at 70% 70%, rgba(139,92,246,0.06), transparent 50%);
    opacity: 0.6;
    mix-blend-mode: multiply;
}

body::after {
    content: "";
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    z-index: 0;
    background-image: 
        radial-gradient(circle at 25% 25%, rgba(255,255,255,0.4) 0%, transparent 50%),
        radial-gradient(circle at 75% 75%, rgba(255,255,255,0.3) 0%, transparent 50%),
        linear-gradient(135deg, rgba(99,102,241,0.03) 0%, transparent 50%),
        linear-gradient(45deg, rgba(139,92,246,0.02) 0%, transparent 50%);
    opacity: 0.5;
    mix-blend-mode: overlay;
}

/* Декоративные плавающие орнаменты */
.background-ornaments {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}

/* Волны на весь экран */
.wave {
    position: fixed;
    left: 0;
    width: 100%;
    z-index: 0;
    pointer-events: none;
}

.wave svg {
    display: block;
    width: 100%;
    height: 100%;
}

.wave-top {
    top: 0;
    height: 140px;
}

.ornament {
    position: absolute;
    border-radius: 50%;
    filter: blur(40px);
    opacity: 0;
    animation: ornamentFloat 20s ease-in-out infinite;
}

.ornament-1 {
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, rgba(99,102,241,0.25), rgba(99,102,241,0));
    top: 10%;
    left: 5%;
    animation-delay: 0s;
    animation-duration: 18s;
}

.ornament-2 {
    width: 250px;
    height: 250px;
    background: radial-gradient(circle, rgba(139,92,246,0.20), rgba(139,92,246,0));
    top: 60%;
    right: 10%;
    animation-delay: 4s;
    animation-duration: 22s;
}

.ornament-3 {
    width: 200px;
    height: 200px;
    background: radial-gradient(circle, rgba(79,70,229,0.18), rgba(79,70,229,0));
    bottom: 15%;
    left: 15%;
    animation-delay: 8s;
    animation-duration: 16s;
}

.ornament-4 {
    width: 180px;
    height: 180px;
    background: radial-gradient(circle, rgba(99,102,241,0.15), rgba(99,102,241,0));
    top: 40%;
    right: 25%;
    animation-delay: 12s;
    animation-duration: 20s;
}

@keyframes ornamentFloat {
    0%, 100% {
        transform: translate(0, 0) scale(1);
        opacity: 0;
    }
    10% {
        opacity: 0.4;
    }
    50% {
        transform: translate(30px, -40px) scale(1.1);
        opacity: 0.6;
    }
    90% {
        opacity: 0.4;
    }
    100% {
        transform: translate(0, 0) scale(1);
        opacity: 0;
    }
}

/* Интерактивный эффект при наведении на карточки */
.card {
    transition: box-shadow 0.3s ease;
    position: relative;
}

.card::before {
    transition: opacity 0.3s ease;
}


/* Эффект "магнитного поля" вокруг активных панелей */
.panel.active .card.depth-active {
    position: relative;
}

.panel.active .card.depth-active::after {
    content: "";
    position: absolute;
    inset: -4px;
    border-radius: 18px;
    background: radial-gradient(
        ellipse at center,
        rgba(79,70,229,0.08) 0%,
        rgba(79,70,229,0.04) 40%,
        transparent 70%
    );
    opacity: 0;
    animation: magneticField 3s ease-in-out infinite;
    pointer-events: none;
    z-index: -1;
}

@keyframes magneticField {
    0%, 100% {
        opacity: 0;
        transform: scale(1);
    }
    50% {
        opacity: 1;
        transform: scale(1.02);
    }
}

/* Легкое свечение вокруг активных элементов */
.nav-btn.active::after {
    content: "";
    position: absolute;
    inset: -2px;
    border-radius: 10px;
    background: radial-gradient(circle at center, rgba(79,70,229,0.1), transparent 70%);
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
    z-index: -1;
}

.nav-btn.active:hover::after {
    opacity: 1;
}

.settings-page {
    min-height: 100vh;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding: 20px 16px 12px 16px;
    position: relative;
    z-index: 1;
    transition: background 0.2s ease;
}

.settings-layout {
    width: 100%;
    max-width: 980px;
    display: grid;
    grid-template-columns: 220px minmax(0, 1fr);
    gap: 20px;
    align-items: start;
    margin-top: 35px;
}

.sidebar {
    position: sticky;
    top: 16px;
    align-self: start;
    border-radius: 12px;
    padding: 10px;
    overflow: visible;
    transition: padding .18s ease, border-color .18s ease, background .18s ease;
    background: linear-gradient(
            180deg,
            rgba(255,255,255,0.92),
            rgba(255,255,255,0.40)
    );
    border: 1px solid rgba(255,255,255,0.75);
    backdrop-filter: blur(10px) saturate(1.1);
    box-shadow:
            inset 0 1px 0 rgba(255,255,255,0.75),
            0 8px 24px rgba(79,70,229,0.06);
}

.nav-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
    transition: gap .18s ease;
}

.nav-item {
    width: 100%;
}

.nav-indicator {
    position: absolute;
    left: 3px;
    width: 4px;
    border-radius: 999px;
    background: linear-gradient(180deg, #6366f1, #4f46e5);
    box-shadow:
            0 0 0 1px rgba(79,70,229,0.18),
            0 6px 14px rgba(79,70,229,0.30);
    opacity: 0.3;
    pointer-events: none;
    transform-origin: center;
    transform: scaleY(1);
    transition:
        top .34s cubic-bezier(0.22, 1, 0.36, 1),
        height .34s cubic-bezier(0.22, 1, 0.36, 1),
        transform .36s cubic-bezier(0.22, 1.35, 0.36, 1),
        opacity .16s ease,
        box-shadow .3s ease;
    z-index: 2;
    animation: navIndicatorPulse 2s ease-in-out infinite;
}

@keyframes navIndicatorPulse {
    0%, 100% {
        box-shadow:
            0 0 0 1px rgba(79,70,229,0.18),
            0 6px 14px rgba(79,70,229,0.28);
        opacity: 0.35;
    }
    50% {
        box-shadow:
            0 0 0 1px rgba(79,70,229,0.22),
            0 6px 16px rgba(79,70,229,0.35),
            0 0 12px rgba(79,70,229,0.08);
        opacity: 0.45;
    }
}

.nav-indicator.spring {
    transform: scaleY(0.72);
}

.sidebar.compact .nav-indicator.spring {
    transform: scaleY(0.8);
}

.nav-btn {
    width: 100%;
    border: none;
    background: transparent;
    text-align: left;
    padding: 8px 10px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    color: #4b5563;
    cursor: pointer;
    transition: background .15s ease, color .15s ease, box-shadow .18s ease, padding .18s ease, font-size .18s ease;
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.nav-main {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.nav-icon {
    width: 18px;
    height: 18px;
    flex: 0 0 auto;
    opacity: 0.9;
}

.nav-btn.active .nav-icon {
    opacity: 1;
}

.nav-label {
    display: inline-block;
    min-width: 0;
}

.nav-btn:hover {
    background: rgba(17,24,39,0.035);
}

.nav-btn.active {
    background: rgba(79,70,229,0.26);
    color: #111827;
    box-shadow:
            inset 3px 0 0 rgba(79,70,229,0.3),
            inset 0 1px 0 rgba(255,255,255,0.5),
            inset 0 0 0 1px rgba(79,70,229,0.18),
            0 2px 6px rgba(79,70,229,0.10);
}

.nav-btn.active:focus-visible {
    box-shadow:
        inset 0 1px 0 rgba(255,255,255,0.45),
        inset 0 0 0 1px rgba(79,70,229,0.12),
        0 1px 3px rgba(79,70,229,0.08),
        0 0 0 2px rgba(79,70,229,0.16);
}

.nav-btn.nav-core {
    color: #1f2937;
    font-weight: 550;
}

.nav-btn.nav-core:hover {
    background: rgba(79,70,229,0.08);
}

.nav-btn.nav-support {
    color: #4b5563;
    font-weight: 500;
}

.nav-btn.nav-admin {
    color: #6b7280;
    font-weight: 500;
}

.nav-btn.nav-admin:hover {
    background: rgba(107,114,128,0.08);
}

.nav-btn.nav-core.active {
    background: rgba(79,70,229,0.1);
    color: #0f172a;
}

.nav-btn.nav-support.active {
    background: rgba(17,24,39,0.12);
    color: #111827;
}

.nav-btn.nav-admin.active {
    background: rgba(107,114,128,0.16);
    color: #1f2937;
}

.nav-btn.nav-support.active::before {
    background: #6b7280;
    opacity: 0.55;
}

.nav-btn.nav-admin.active::before {
    background: #9ca3af;
    opacity: 0.45;
}

.nav-subtext {
    display: block;
    margin-top: 2px;
    font-size: 11px;
    line-height: 1.2;
    color: rgba(107,114,128,0.85);
    font-weight: 500;
    opacity: 0.45;
    transition: opacity .16s ease;
}

.nav-btn.nav-core .nav-subtext {
    color: rgba(79,70,229,0.75);
}

.nav-btn.nav-support .nav-subtext {
    color: rgba(75,85,99,0.75);
}

.nav-btn.nav-admin .nav-subtext {
    color: rgba(107,114,128,0.75);
}

.nav-btn.active .nav-subtext {
    opacity: 1;
    font-weight: 600;
}

.nav-btn:hover .nav-subtext {
    opacity: 0.7;
}

.sidebar.compact .nav-subtext {
    display: none;
}

.sidebar.compact {
    padding: 8px;
}

.sidebar.compact .nav-list {
    gap: 2px;
}

.sidebar.compact .nav-btn {
    padding: 6px 8px;
    font-size: 13px;
}

.sidebar.compact .nav-btn.active {
    box-shadow:
        inset 0 1px 0 rgba(255,255,255,0.42),
        inset 0 0 0 1px rgba(79,70,229,0.10),
        0 1px 2px rgba(79,70,229,0.06);
}

.content-column {
    min-width: 0;
    position: relative;
    transition: min-height .22s cubic-bezier(0.22, 1, 0.36, 1);
}


/* Signature calm beam (brand silhouette) */
.content-column::before {
    content: "";
    position: absolute;
    top: -40px;
    bottom: -40px;
    left: 50%;
    width: 520px;
    transform: translateX(-50%);
    pointer-events: none;
    z-index: 0;
    background: radial-gradient(
        60% 100% at 50% 0%,
        rgba(79,70,229,0.10),
        rgba(79,70,229,0.06) 40%,
        rgba(79,70,229,0.03) 65%,
        transparent 85%
    );
    filter: blur(28px);
    opacity: 0.2;
    animation: calmBreath 14s ease-in-out infinite;
    transform-origin: 50% 0%;
}

/* Vertical rhythm lines (subtle alignment grid) */
.content-column .rhythm-lines {
    position: absolute;
    inset: -32px 0 -32px 0;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}

.content-column .rhythm-lines::before {
    content: "";
    position: absolute;
    top: 0;
    bottom: 0;
    /*margin-top: 100px;*/
    left: 38px;
    width: 1px;
    background: linear-gradient(
        180deg,
        rgba(79,70,229,0),
        rgba(79,70,229,0.10) 20%,
        rgba(79,70,229,0.06) 50%,
        rgba(79,70,229,0.09) 80%,
        rgba(79,70,229,0)
    );
    opacity: 0.70;
    animation: calmOpacityShift 20s ease-in-out infinite;
}

.content-column .rhythm-lines::after {
    content: "";
    position: absolute;
    top: 0;
    bottom: 0;
    left: 120px;
    width: 1px;
    background: linear-gradient(
        180deg,
        rgba(79,70,229,0),
        rgba(79,70,229,0.07) 22%,
        rgba(79,70,229,0.04) 50%,
        rgba(79,70,229,0.06) 78%,
        rgba(79,70,229,0)
    );
    opacity: 0.45;
    animation: calmOpacityShift 24s ease-in-out infinite;
}

/* Signature anchor line (persistent visual axis) */
.content-column::after {
    content: "";
    position: absolute;
    top: -32px;
    bottom: -32px;
    left: 10px;
    width: 1px;
    pointer-events: none;
    z-index: 0;
    background: linear-gradient(
        180deg,
        rgba(79,70,229,0),
        rgba(79,70,229,0.16) 18%,
        rgba(79,70,229,0.08) 55%,
        rgba(79,70,229,0.14) 82%,
        rgba(79,70,229,0)
    );
    opacity: 0.9;
    animation: calmOpacityShift 18s ease-in-out infinite;
}

.content-column::after {
    filter: drop-shadow(0 0 10px rgba(79,70,229,0.10));
}

/* Axis navigation node */
.axis-node {
    position: absolute;
    left: 6px; /* centered on 1px anchor line */
    width: 9px;
    height: 9px;
    border-radius: 999px;
    background: #4f46e5;
    box-shadow:
        0 0 0 2px rgba(255,255,255,0.9),
        0 0 12px rgba(79,70,229,0.45);
    transform: translateY(-50%);
    transition:
        top .38s cubic-bezier(0.22, 1, 0.36, 1),
        box-shadow .22s ease,
        opacity .22s ease;
    z-index: 1;
    pointer-events: none;
    opacity: 0;
    display: none;
}

.axis-node.active {
    opacity: 1;
    animation: calmOpacityShift 7s ease-in-out infinite;
}

/* Keep the axis subtle on mobile where layout becomes single-column */
@media (max-width: 640px) {
    .content-column::after {
        display: none;
    }
    .content-column .rhythm-lines {
        display: none;
    }
}

.state-anchor {
    position: sticky;
    top: 0;
    z-index: 1000;
    margin-bottom: 8px;
}

.state-anchor-card {
    background: linear-gradient(
            180deg,
            rgba(255,255,255,0.92),
            rgba(255,255,255,0.40)
    );
    border: 0.5px solid rgba(79,70,229,0.16);
    box-shadow:
            inset 0 1px 0 rgba(255,255,255,0.09),
            0 30px 26px rgba(79,70,229,0.04),
            0 0 0 1px rgba(79,70,229,0.06);
    backdrop-filter: blur(12px) saturate(1.08);
    position: relative;
    border-radius: 12px;
    padding: 8px 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-left: -10px;
}

.state-anchor-card::before {
    content: "";
    position: absolute;
    inset: -1px;
    border-radius: 12px;
    pointer-events: none;
    background: radial-gradient(
            140% 70% at 50% -20%,
            rgba(79,70,229,0.10),
            transparent 70%
    );
    opacity: 0.65;
    z-index: -1;
}

.state-anchor-left {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    min-width: 0;
}

.state-anchor-title {
    font-size: 12px;
    font-weight: 600;
    color: #374151;
    white-space: nowrap;
}

.state-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 8px;
    font-size: 11px;
    border-radius: 999px;
    background: rgba(17,24,39,0.05);
    color: #4b5563;
    white-space: nowrap;
}

.state-chip .dot {
    width: 6px;
    height: 6px;
    border-radius: 999px;
    background: #9ca3af;
}

.state-chip.ok .dot {
    background: #22c55e;
}

.state-chip.warn .dot {
    background: #f59e0b;
}

.state-anchor-right {
    font-size: 11px;
    color: #6b7280;
    white-space: nowrap;
}

.anchor-usage {
    display: inline-flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
    width: fit-content;
    min-width: 0;
}

.anchor-usage-line {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    color: #6b7280;
    white-space: nowrap;
    width: fit-content;
}

.anchor-usage {
    --usage-bar-indent: 52px;
}

.anchor-usage-label {
    font-weight: 600;
    color: #4b5563;
}

.anchor-usage-value {
    font-weight: 600;
    color: #374151;
}

.anchor-usage-reset {
    color: #9ca3af;
    font-size: 10px;
}

.anchor-usage-bar {
    width: calc(112% - var(--usage-bar-indent));
    margin-left: var(--usage-bar-indent);
    height: 8px;
    border-radius: 999px;
    background: rgba(17,24,39,0.08);
    position: relative;
    box-shadow:
        inset 0 1px 0 rgba(255,255,255,0.55),
        inset 0 -1px 0 rgba(0,0,0,0.03);
    overflow: hidden;
}

.anchor-usage-fill {
    height: 100%;
    border-radius: 999px;
    background: linear-gradient(
        to bottom,
        rgba(99,102,241,0.46),
        rgba(79,70,229,0.34)
    );
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.28);
    transition: width .25s ease;
    position: relative;
    overflow: hidden;
}

.anchor-usage-fill::before {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    top: 0;
    height: 50%;
    background: linear-gradient(
        to bottom,
        rgba(255,255,255,0.22),
        rgba(255,255,255,0)
    );
    pointer-events: none;
}

.anchor-usage-fill::after {
    content: "";
    position: absolute;
    top: 0;
    bottom: 0;
    width: 65%;
    background: linear-gradient(
            90deg,
            rgba(255,255,255,0),
            rgba(255,255,255,0.95),
            rgba(255,255,255,0)
    );
    transform: translateX(-130%);
    opacity: 0;
    pointer-events: none;
}

.anchor-usage-fill.is-active::after {
    animation: usageShimmer 5.5s ease-in-out infinite;
}

@media (max-width: 640px) {
    .state-anchor {
        position: static;
        margin-bottom: 10px;
    }

    .state-anchor-card {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .state-anchor-right {
        white-space: normal;
    }

    .anchor-usage {
        align-items: flex-start;
        width: 100%;
        --usage-bar-indent: 0px;
    }

    .anchor-usage-line {
        flex-wrap: wrap;
    }

    .anchor-usage-bar {
        width: 100%;
        margin-left: 0;
    }
}

.panel {
    display: block;
    opacity: 1;
    transform: translateY(4px);
    pointer-events: none;
    position: absolute;
    inset: 0;
    transition: transform 1.50s cubic-bezier(0.16, 1, 0.3, 1);
    will-change: transform;
    visibility: hidden;
    z-index: 0;
}

.panel.active {
    opacity: 0.78;
    transform: translateY(0);
    pointer-events: auto;
    position: relative;
    visibility: visible;
    z-index: 3;
}

.panel-placeholder {
    visibility: hidden;
    pointer-events: none;
}

.brand {
    width: 100%;
    max-width: 980px;
    margin-bottom: 7px;
    padding-left: 7px;
    text-align: left;
    position: relative;
    z-index: 1;
    animation: brandEntrance 0.8s cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes brandEntrance {
    0% {
        opacity: 0;
        transform: translateY(-10px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

.brand-title {
    font-size: 30px;
    font-weight: 900;
    letter-spacing: -0.3px;
    margin: 0;
    color: #111827;
}

.brand-title-row {
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.brand-logo {
    height: 50px;
    width: auto;
    display: block;
    filter: drop-shadow(0 0 15px rgba(79,70,229,0.5));
    transition: filter 0.3s ease, transform 0.3s ease;
    animation: logoGlow 3s ease-in-out infinite;
    position: relative;
}

.brand-logo::after {
    content: "";
    position: absolute;
    inset: -8px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(99,102,241,0.4), transparent 70%);
    opacity: 0;
    animation: logoGlowRing 3s ease-in-out infinite;
    pointer-events: none;
    z-index: -1;
}

.brand-logo:hover {
    filter: drop-shadow(0 0 20px rgba(99,102,241,0.7)) drop-shadow(0 0 30px rgba(79,70,229,0.4));
    transform: scale(1.05);
}

@keyframes logoGlow {
    0%, 100% {
        filter: drop-shadow(0 0 15px rgba(79,70,229,0.5)) drop-shadow(0 0 25px rgba(99,102,241,0.3));
    }
    50% {
        filter: drop-shadow(0 0 25px rgba(99,102,241,0.7)) drop-shadow(0 0 35px rgba(139,92,246,0.5));
    }
}

@keyframes logoGlowRing {
    0%, 100% {
        opacity: 0;
        transform: scale(0.8);
    }
    50% {
        opacity: 0.6;
        transform: scale(1.2);
    }
}

.brand-main {
    background: linear-gradient(90deg, #111827, #4f46e5);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    color: transparent;
    text-shadow:
            0 1px 0 rgba(255,255,255,0.1),
            0 -1px 0 rgba(0,0,0,0.05);
}

.brand-title span {
    font-weight: 600;
    opacity: 0.7;
    color: #374151;
}

.brand-subtitle {
    font-size: 14px;
    color: #6b7280;
    margin-top: 4px;
    text-shadow:
        0 1px 0 rgba(255,255,255,0.5),
        0 -1px 0 rgba(0,0,0,0.05);
}

.beta-badge {
    display: inline-block;
    margin-left: 10px;
    padding: 2px 8px;
    font-size: 11px;
    font-weight: 600;
    border-radius: 999px;
    background: rgba(79,70,229,0.2);
    color: #4f46e5;
    vertical-align: middle;
}

.brand-meta {
    position: absolute;
    top: 0;
    right: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
    align-items: flex-end;
    opacity: 0.92;
}

.brand-meta .meta-pill {
    background: rgba(255,255,255,0.38);
    filter: saturate(0.88);
}

.brand-meta .session-pill {
    background: rgba(255,255,255,0.52);
    filter: saturate(0.95);
}

.meta-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    font-size: 12px;
    line-height: 1.2;
    border-radius: 12px;
    background: rgba(255,255,255,0.55);
    border: 1px solid rgba(229,231,235,0.9);
    color: #4b5563;
    backdrop-filter: blur(6px);
    overflow: hidden;
}

.meta-dot {
    width: 7px;
    height: 7px;
    border-radius: 999px;
    background: #9ca3af;
}

.meta-pill.ok .meta-dot {
    background: #22c55e;
}

.meta-pill.warn .meta-dot {
    background: #f59e0b;
}

.meta-pill.down .meta-dot {
    background: #ef4444;
}

@keyframes pulseDot {
    0% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.25);
        opacity: 0.7;
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

@keyframes usageShimmer {
    0% {
        transform: translateX(-120%);
        opacity: 0;
    }
    25% {
        opacity: 0.18;
    }
    60% {
        opacity: 0.12;
    }
    100% {
        transform: translateX(220%);
        opacity: 0;
    }
}

@keyframes calmBreath {
    0% {
        opacity: 0.16;
        transform: translateX(-50%) scale(1);
    }
    50% {
        opacity: 0.22;
        transform: translateX(-50%) scale(1.015);
    }
    100% {
        opacity: 0.16;
        transform: translateX(-50%) scale(1);
    }
}

@keyframes calmOpacityShift {
    0% { opacity: 0.40; }
    50% { opacity: 0.55; }
    100% { opacity: 0.40; }
}

.meta-pill.ok .meta-dot {
    /* animation: pulseDot 1.8s ease-in-out infinite; */
}

.status-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: #111827;
}

.status-pill .dot {
    width: 7px;
    height: 7px;
    border-radius: 999px;
    background: #22c55e;
    animation: pulseDot 1.8s ease-in-out infinite;
}

.status-pill .dot-red {
    width: 7px;
    height: 7px;
    border-radius: 999px;
    background: #c62323;
    animation: pulseDot 1.8s ease-in-out infinite;
}

.status-pill .dot-grey {
    width: 7px;
    height: 7px;
    border-radius: 999px;
    background: #bfbfbf;
}

.meta-strong {
    color: #111827;
    font-weight: 600;
}

.integration-indicator {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 8px;
    font-size: 11px;
    font-weight: 500;
    border-radius: 999px;
    background: rgba(37,99,235,0.08);
    color: #1d4ed8;
    border: 1px solid rgba(37,99,235,0.18);
}

.integration-indicator .dot {
    width: 6px;
    height: 6px;
    border-radius: 999px;
    background: #1d4ed8;
}

.integration-indicator.muted {
    background: rgba(107,114,128,0.08);
    color: #6b7280;
    border: 1px solid rgba(107,114,128,0.18);
}

.integration-indicator.muted .dot {
    background: #9ca3af;
}

.insight-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-top: 10px;
    padding: 6px 10px;
    border-radius: 10px;
    background: rgba(79,70,229,0.06);
    border: 1px solid rgba(79,70,229,0.16);
    color: #374151;
    font-size: 12px;
    line-height: 1.3;
}

.insight-dot {
    width: 7px;
    height: 7px;
    border-radius: 999px;
    background: #4f46e5;
    flex: 0 0 auto;
}

.insight-strong {
    font-weight: 600;
    color: #111827;
}

.section-label {
    position: relative;
    width: 100%;
    max-width: 800px;
    margin: 26px 0 8px;
    padding-left: 4px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: rgba(107,114,128,0.9);
    transform: translateY(1px);
    display: inline-flex;
    align-items: center;
    gap: 6px;
}


.help {
    position: relative;
    display: inline-flex;
    align-items: center;
    margin-left: 6px;
    z-index: 1000;
}
.help-icon {
    width: 14px;
    height: 14px;
    border-radius: 999px;
    border: 1px solid rgba(107,114,128,0.45);
    color: #6b7280;
    font-size: 10px;
    line-height: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: default;
    background: rgba(255,255,255,0.75);
}
.help-bubble {
    position: absolute;
    left: 50%;
    transform: translateX(-50%) translateY(6px);
    bottom: calc(100%);
    min-width: 180px;
    max-width: 240px;
    padding: 9px 11px;
    border-radius: 8px;

    background: rgba(17,24,39,0.9);   /* почти непрозрачный */
    color: #ffffff;

    font-size: 12px;
    line-height: 1.42;

    box-shadow: 0 12px 30px rgba(0,0,0,0.32);
    opacity: 0;
    visibility: hidden;
    pointer-events: auto;
    transition:
            opacity .16s ease,
            transform .16s ease,
            visibility .16s ease;

    z-index: 999;
}
.help-bubble a {
    color: #93c5fd;
    text-decoration: underline;
}
.help:hover .help-bubble,
.help-bubble:hover {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}

.section-label-icon {
    width: 14px;
    height: 14px;
    flex: 0 0 auto;
    opacity: 0.75;
}

/* Native axis dot bound to the section label */
.section-label::before {
    display: none;
}

.panel-tone-core .section-label {
    color: rgba(79,70,229,0.85);
}

.panel-tone-core .card-title {
    color: #111827;
    font-weight: 600;
}

.panel-tone-support .section-label {
    color: rgba(55,65,81,0.75);
}

.panel-tone-support .card-title {
    color: #1f2937;
    font-weight: 600;
}

.panel-tone-admin .section-label {
    color: rgba(107,114,128,0.9);
}

.panel-tone-admin .card-title {
    color: #374151;
    font-weight: 600;
}

.panel-tone-admin .card-helper {
    color: #6b7280;
}

.page-end-marker {
    width: 100%;
    max-width: 800px;
    margin: 6px 0 10px 320px;
    text-align: left;
    font-size: 12px;
    color: rgba(107,114,128,0.55);
    letter-spacing: 0.02em;
    user-select: none;
    pointer-events: none;
}

.footer {
    width: 100%;
    max-width: 980px;
    padding-top: 16px;
    margin-top: auto;
    border-top: 1px solid #e5e7eb;
    font-size: 13px;
    color: #6b7280;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    position: relative;
    z-index: 1;
    opacity: 0.75;
}

.footer-left {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.footer-right {
    opacity: 0.8;
}

.footer a {
    color: #6b7280;
    text-decoration: none;
    transition: color 0.15s ease, opacity 0.15s ease;
}

.footer a:hover {
    color: #374151;
    opacity: 0.9;
    text-decoration: underline;
}

.card {
    background: #f4f4ff;
    border: 1px solid #e2e2e2;
    border-radius: 14px;
    padding: 26px;
    margin-bottom: 16px;
    /* Depth tokens */
    --card-shadow-rest: 0 4px 10px rgba(0, 0, 0, 0.025), 6px 6px 18px rgba(0, 0, 0, 0.035);
    --card-shadow-hover: 0 8px 20px rgba(0, 0, 0, 0.045), 8px 8px 22px rgba(0, 0, 0, 0.055);
    --card-top-accent-opacity: 0.55;
    box-shadow: var(--card-shadow-rest);
    width: 100%;
    max-width: 800px;
    transition: box-shadow .18s ease, opacity 0.4s ease, transform 0.4s ease;
    position: relative;
    z-index: 1;
    /* Density tokens */
    --card-row-gap: 12px;
    --card-row-padding-y: 4px;
    --card-list-item-y: 12px;
    --gravity-hover-bg: rgba(17,24,39,0.03);
    --gravity-focus-ring: 0 0 0 2px rgba(79,70,229,0.18);
    animation: cardEntrance 0.6s cubic-bezier(0.22, 1, 0.36, 1) backwards;
}

.panel.active .card:nth-child(1) { animation-delay: 0.1s; }
.panel.active .card:nth-child(2) { animation-delay: 0.2s; }
.panel.active .card:nth-child(3) { animation-delay: 0.3s; }

@keyframes cardEntrance {
    0% {
        opacity: 0;
        transform: translateY(10px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

.card .card-header {
    position: relative;
}

/*.card .card-header::before {
    content: "";
    position: absolute;
    left: -8px;
    top: 12px;
    width: 4px;
    height: 1px;
    border-radius: 999px;
    background: rgba(79,70,229,0.24);
    pointer-events: none;
}*/

/* Signature corner accent */
.card .card-header::after {
    content: "";
    position: absolute;
    top: -15px;
    right: -15px;
    width: 18px;
    height: 18px;
    opacity: 0.45;

    border-top: 1px solid rgba(79,70,229,0.22);
    border-right: 1px solid rgba(79,70,229,0.22);
    border-top-right-radius: 10px;

    pointer-events: none;
}

.panel-tone-support .card .card-header::after {
    border-color: rgba(107,114,128,0.20);
    opacity: 0.45;
}

.panel-tone-admin .card .card-header::after {
    border-color: rgba(156,163,175,0.18);
    opacity: 0.40;
}

.card.card-dense {
    padding: 18px 20px;
    --card-row-gap: 8px;
    --card-row-padding-y: 2px;
    --card-list-item-y: 10px;
}

.card.card-comfortable {
    padding: 22px;
    --card-row-gap: 10px;
    --card-row-padding-y: 3px;
    --card-list-item-y: 10px;
}

.card.card-dense .card-title {
    font-size: 15px;
}

.card::before {
    content: "";
    position: absolute;
    left: 14px;
    right: 14px;
    top: 0;
    height: 2px;
    border-radius: 999px;
    background: linear-gradient(
            90deg,
            rgba(79,70,229,0),
            rgba(79,70,229,0.25),
            rgba(79,70,229,0)
    );
    opacity: var(--card-top-accent-opacity);
    pointer-events: none;
}

.card::after {
    content: "";
    position: absolute;
    left: 18px;
    right: 18px;
    bottom: 0;
    height: 1px;
    background: linear-gradient(
            90deg,
            rgba(79,70,229,0),
            rgba(79,70,229,0.10),
            rgba(79,70,229,0)
    );
    opacity: 0.35;
    pointer-events: none;
}

.card:hover {
    box-shadow: var(--card-shadow-hover);
}

.panel-tone-support .card.depth-passive::before,
.panel-tone-admin .card::before {
    opacity: 0;
}

.primary-card {
    --card-shadow-rest: 0 10px 24px rgba(0, 0, 0, 0.05), 8px 8px 26px rgba(0, 0, 0, 0.06);
    --card-shadow-hover: 0 14px 30px rgba(0, 0, 0, 0.06), 12px 12px 32px rgba(0, 0, 0, 0.075);
    --card-top-accent-opacity: 0.75;
}

.action-card {
    background: #fbfbfc;
    border-color: #e5e7eb;
}

.card.depth-passive {
    --card-shadow-rest: 0 2px 6px rgba(0,0,0,0.018), 4px 4px 12px rgba(0,0,0,0.025);
    --card-shadow-hover: 0 4px 12px rgba(0,0,0,0.03), 6px 6px 14px rgba(0,0,0,0.035);
    --card-top-accent-opacity: 0.35;
    --gravity-hover-bg: rgba(17,24,39,0.02);
}

.card.depth-active {
    --card-shadow-rest: 0 4px 10px rgba(0,0,0,0.025), 6px 6px 18px rgba(0,0,0,0.035);
    --card-shadow-hover: 0 8px 20px rgba(0,0,0,0.045), 8px 8px 22px rgba(0,0,0,0.055);
    --card-top-accent-opacity: 0.55;
    --gravity-hover-bg: rgba(79,70,229,0.035);
}

.card.depth-primary {
    --card-shadow-rest: 0 10px 24px rgba(0,0,0,0.05), 8px 8px 26px rgba(0,0,0,0.06);
    --card-shadow-hover: 0 14px 30px rgba(0,0,0,0.06), 12px 12px 32px rgba(0,0,0,0.075);
    --card-top-accent-opacity: 0.75;
    --gravity-hover-bg: rgba(79,70,229,0.055);
}

.card-title {
    font-weight: 700;
    font-size: 19px;
    color: #0f172a;
    margin: 0;
}

.card-helper {
    margin-top: 4px;
    font-size: 13px;
    color: #767e8b;
}

.card-header {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0;
}

.card-header .card-helper {
    margin-top: 4px;
}

.auth {
    margin: 0;
}

.logout {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: #ef4444;
    text-decoration: none;
    font-weight: 500;
}

.logout:hover {
    text-decoration: underline;
}

.danger-zone {
    margin-top: 8px;
    padding-top: 10px;
    display: flex;
    align-items: center;
}

.email-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.mt-16 {
    margin-top: 16px;
}

.email {
    font-family: monospace;
    background: #ebebeb;
    padding: 6px 10px;
    border-radius: 6px;
    word-break: break-all;
    transition: background 0.15s ease, box-shadow 0.15s ease;
}

.email:hover {
    background: #e5e7eb;
    box-shadow: inset 0 0 0 1px rgba(0,0,0,0.04);
}

.checkbox-list {
    list-style: none;
    padding: 0;
    margin: 8px 0 0;
}

.checkbox-list li {
    padding: var(--card-list-item-y) 0;
    border-bottom: 1px solid #f3f4f6;
}

.checkbox-list li:last-child {
    border-bottom: none;
}

.btn {
    border: none;
    border-radius: 8px;
    padding: 8px 14px;
    font-weight: 500;
    cursor: pointer;
}

.btn,
.switch .slider,
a.logout {
    transition: box-shadow .15s ease, transform .12s ease, background .15s ease;
}

.btn:focus-visible,
.switch input:focus-visible + .slider,
a.logout:focus-visible {
    outline: none;
    box-shadow: var(--gravity-focus-ring);
}

.btn-quiet {
    opacity: 0.9;
}

.btn-quiet:hover {
    opacity: 1;
}

.btn-primary {
    background: #1d4ed8;
    color: #ffffff;
    position: relative;
    overflow: visible;
}

.btn-primary::before {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.8), rgba(255, 255, 255, 0.4), transparent 70%);
    transform: translate(-50%, -50%);
    transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1), height 0.5s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.5s ease;
    opacity: 0;
    pointer-events: none;
    z-index: 0;
}

.btn-primary::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.6), rgba(255, 255, 255, 0.2), transparent 70%);
    transform: translate(-50%, -50%);
    transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1), height 0.6s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.6s ease;
    opacity: 0;
    pointer-events: none;
    z-index: 0;
}

.btn-primary:active::before {
    width: 400px;
    height: 400px;
    opacity: 1;
    transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1), height 0.4s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.4s ease;
}

.btn-primary:active::after {
    width: 500px;
    height: 500px;
    opacity: 0.6;
    transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1), height 0.5s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.5s ease;
    transition-delay: 0.1s;
}

.btn-primary:hover {
    background: #1e40af;
    transform: translateY(-0.5px);
    box-shadow: 0 4px 12px rgba(29, 78, 216, 0.3);
}

.btn-primary > * {
    position: relative;
    z-index: 1;
}

.btn-secondary {
    background: #e5e7eb;
    color: #111827;
}

.btn-secondary:hover {
    background: #d1d5db;
}

.btn-quiet {
    background: #ebebeb;
    color: #374151;
    border: 1px solid #e5e7eb;
}

.btn-quiet:hover {
    background: #e5e7eb;
}

.btn-danger {
    background: rgba(239,68,68,0.08);
    color: #b91c1c;
    border: 1px solid rgba(239,68,68,0.28);
}

.btn-danger:hover {
    background: rgba(239,68,68,0.14);
}

.btn-success {
    background: #22c55e;
    color: #ffffff;
}

.btn-success:hover {
    background: #22c55e;
    cursor: default;
}
.row-between {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.panel-stack {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: calc(var(--card-row-gap) - 1px);
}

.card .row-between {
    padding: var(--card-row-padding-y) 6px;
    border-radius: 8px;
    transition: background 0.15s ease;
}

.card .row-between:hover {
    background: var(--gravity-hover-bg);
}
.card .row-between.no-hover:hover {
    background: transparent;
}
.card > .row-between + .integration-row,
.card > .row-between + .checkbox-list,
.card > .row-between + .mt-16 {
    margin-top: var(--card-row-gap);
}

.setting-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    cursor: pointer;
    padding: 2px 0;
}

.checkbox-list .setting-row > span:first-child {
    font-size: 13px;
    display: inline-flex;
    flex-direction: column;
    line-height: 1.25;
}

.setting-desc {
    font-size: 11px;
    color: #6b7280;
    font-weight: 500;
    margin-top: 2px;
}

.switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #d1d5db;
    box-shadow: inset 0 0 0 1px rgba(0,0,0,0.04);
    transition: background-color .18s ease, box-shadow .16s ease;
    border-radius: 999px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    top: 3px;
    background-color: white;
    border-radius: 50%;
    box-shadow: 0 1px 2px rgba(0,0,0,0.16);

    transition:
            transform 260ms cubic-bezier(0.22, 1.2, 0.36, 1),
            box-shadow 160ms ease;
}

.card.depth-active .slider:hover,
.card.depth-primary .slider:hover {
    box-shadow: inset 0 0 0 1px rgba(79,70,229,0.22);
}

.card.depth-active .switch:hover .slider:before,
.card.depth-primary .switch:hover .slider:before {
    transform: translateX(1px);
}

.card.depth-active .switch input:checked + .slider:before,
.card.depth-primary .switch input:checked + .slider:before {
    transform: translateX(20px);
}

.card.depth-active .switch:hover input:checked + .slider:before,
.card.depth-primary .switch:hover input:checked + .slider:before {
    transform: translateX(19px);
}

.switch:active .slider:before {
    transform: scale(0.95);
}

.switch input:checked + .slider {
    background-color: #22c55e;
    box-shadow: 
        inset 0 0 0 1px rgba(0,0,0,0.04),
        0 0 0 0 rgba(34, 197, 94, 0.4);
    animation: switchGlow 2s ease-in-out infinite;
}

@keyframes switchGlow {
    0%, 100% {
        box-shadow: 
            inset 0 0 0 1px rgba(0,0,0,0.04),
            0 0 0 0 rgba(34, 197, 94, 0.4);
    }
    50% {
        box-shadow: 
            inset 0 0 0 1px rgba(0,0,0,0.04),
            0 0 0 4px rgba(34, 197, 94, 0.2);
    }
}

/* Глобальный DND-тумблер: базово всегда серый, без зелёного состояния.
   Цвет при включении (красный) управляется только через #sessionPill.dnd-on .switch .slider */
#sessionPill:not(.dnd-on) .switch.switch--dnd .slider,
#sessionPill:not(.dnd-on) .switch.switch--dnd input:checked + .slider {
    background-color: #d1d5db;
}

/* Calm certainty states */
.switch.is-saving .slider {
    box-shadow:
            inset 0 0 0 1px rgba(79,70,229,0.22),
            0 0 0 4px rgba(79,70,229,0.06);
}

.switch.is-pending-on .slider {
    background-color: #22c55e;
}

.switch.is-pending-off .slider {
    background-color: #d1d5db;
}

.switch input:checked + .slider:before {
    transform: translateX(20px);
}

/* pending = лёгкий сдвиг, даже до реального toggle */
.switch.is-pending-on input + .slider:before {
    transform: translateX(6px);   /* чуть вправо */
}

.switch.is-pending-off input + .slider:before {
    transform: translateX(16px);  /* чуть влево, но не до конца */
}

.top-overlay {
    position: fixed;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 800px;
    height: 120px;
    pointer-events: none;
    overflow: hidden;
    z-index: 0;
}

.ai-square {
    position: absolute;
    width: 10px;
    height: 10px;
    opacity: 0;
    border-radius: 3px;
    animation: floatDown 2.5s ease-in-out forwards;
}

.usage-pill {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
    min-width: 160px;
    position: relative;
    padding-bottom: 10px;
}

.usage-line {
    display: inline-flex;
    gap: 6px;
    flex-wrap: wrap;
}

.usage-bar {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 5px;
    border-radius: 0 0 999px 999px;
    background: rgba(17,24,39,0.08);
    overflow: hidden;
    pointer-events: none;
}

.usage-bar-fill {
    height: 100%;
    background: rgba(79,70,229,0.34);
    transition: width .25s ease;
    border-radius: 0 0 999px 999px;
}

.meta-pill.meta-link {
    text-decoration: none;
    color: #4b5563;
}

.meta-pill.meta-link:hover {
    background: rgba(255,255,255,0.75);
}

.session-pill {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 4px 10px;
    font-size: 12px;
    line-height: 1.2;
    border-radius: 12px;
    background: rgba(255,255,255,0.55);
    border: 1px solid rgba(229,231,235,0.9);
    color: #374151;
    backdrop-filter: blur(6px);
}

.session-user {
    font-weight: 600;
    color: #111827;
    white-space: nowrap;
}

.session-divider {
    width: 1px;
    height: 14px;
    background: rgba(156,163,175,0.45);
}

.session-dnd {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: #6b7280;
    font-size: 11px;
    white-space: nowrap;
}

.session-dnd .switch {
    transform: scale(0.9);
    transform-origin: center;
}

/* DND глобальный тумблер — красный цвет ТОЛЬКО при финальном включении */
#sessionPill.dnd-on .switch .slider {
    background-color: #ef4444;
}

/* Специальные переменные для геометрии DND-свитча */
.switch.switch--dnd {
    --dnd-track-width: 44px;
    --dnd-thumb-size: 18px;
    --dnd-thumb-left: 3px;
    /* небольшой визуальный сдвиг центра влево, чтобы "на глаз" было ровно */
    --dnd-center-tweak: -5px;

    /* центр = левый отступ + половина доступного хода + твик */
    --dnd-center-x: calc(
        var(--dnd-thumb-left)
        + (var(--dnd-track-width) - var(--dnd-thumb-size)) / 2
        + var(--dnd-center-tweak)
    );
}

/* Положение ползунка DND отвязываем от :checked и задаём фазами */
#sessionPill .switch .slider:before {
    transform: translateX(0px); /* исходно слева (off) */
}

/* ВКЛЮЧАЕМ (off -> on):
   1) pending-on: сдвиг в центр + пульсация
   2) on: ползунок в крайнем правом положении */
#sessionPill .switch.is-pending-on .slider:before {
    animation: dndThumbPendingOn 700ms ease-out infinite;
}

/* ВЫКЛЮЧАЕМ (on -> off):
   1) pending-off: тот же центр + пульсация
   2) off: полностью слева */
#sessionPill .switch.is-pending-off .slider:before {
    animation: dndThumbPendingOff 700ms ease-out infinite;
}

#sessionPill.dnd-on .switch .slider:before {
    transform: translateX(20px); /* финальное "включено" только после ответа сервера */
}

/* Центр берём из CSS-переменной --dnd-center-x */
@keyframes dndThumbPendingOn {
    0%,
    100% { transform: translateX(var(--dnd-center-x)) scale(1); }
    50%  { transform: translateX(var(--dnd-center-x)) scale(1.08); }
}

@keyframes dndThumbPendingOff {
    0%,
    100% { transform: translateX(var(--dnd-center-x)) scale(1); }
    50%  { transform: translateX(var(--dnd-center-x)) scale(1.08); }
}

.session-pill.dnd-on .session-dnd-label {
    color: #ef4444;
}

.integration-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    margin-top: var(--card-row-gap);
    margin-left: 6px;
    margin-right: 6px;
}

.integration-left {
    display: flex;
    gap: 12px;
}

.integration-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: rgba(37,99,235,0.08);
    border: 1px solid rgba(37,99,235,0.18);
    display: flex;
    align-items: center;
    justify-content: center;
}

.integration-title { font-weight: 600; font-size: 14px; }
.integration-subtitle { font-size: 13px; color: #6b7280; }
.integration-meta { font-size: 12px; color: #6b7280; margin-top: 4px; }

.activity-list {
    list-style: none;
    padding: 0;
    margin: 8px 0 0 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.activity-list li {
    display: flex;
    align-items: center;
    gap: 10px;
}

.activity-dot {
    width: 8px;
    height: 8px;
    border-radius: 999px;
    background: #9ca3af;
}

.activity-text {
    flex: 1;
    font-size: 13px;
    color: #111827;
}

.activity-time {
    font-size: 12px;
    color: #6b7280;
}

.activity-empty {
    color: #6b7280;
}

/* Optimistic toggle feedback (no layout shift) */
.switch.is-saving .slider {
    box-shadow:
        inset 0 0 0 1px rgba(79,70,229,0.28),
        0 0 0 0 rgba(79,70,229,0.22);
    animation: togglePulse 700ms ease-out;
}

.switch.is-saving .slider:before {
    animation: thumbPulse 700ms ease-out;
}

@keyframes thumbPulse {
    0% { transform: scale(1); }
    40% { transform: scale(0.94); }
    100% { transform: scale(1); }
}

@keyframes togglePulse {
    0% {
        box-shadow:
            inset 0 0 0 1px rgba(79,70,229,0.28),
            0 0 0 0 rgba(79,70,229,0.22);
    }
    60% {
        box-shadow:
            inset 0 0 0 1px rgba(79,70,229,0.28),
            0 0 0 6px rgba(79,70,229,0);
    }
    100% {
        box-shadow:
            inset 0 0 0 1px rgba(79,70,229,0.18),
            0 0 0 0 rgba(79,70,229,0);
    }
}

.content-column .state-anchor + .panel .section-label {
    margin-top: 20px;
    opacity: 1;
}

@keyframes floatDown {
    0% {
        transform: translateY(0);
        opacity: 0;
    }
    30% {
        opacity: 0.25;
    }
    100% {
        transform: translateY(20px);
        opacity: 0;
    }
}

@media (prefers-reduced-motion: reduce) {
    .ai-square {
        animation: none;
        opacity: 0 !important;
    }

    .btn,
    .switch .slider {
        transition: none !important;
    }

    .btn-primary:hover {
        transform: none !important;
    }

    .slider:before {
        transition: none !important;
    }

    .switch:active .slider:before {
        transform: none !important;
    }

    .panel,
    .panel .card {
        transition: none !important;
        transform: none !important;
    }

    .anchor-usage-fill.is-active::after {
        animation: none !important;
    }
    .content-column::before {
        filter: none !important;
    }
    .content-column::after {
        filter: none !important;
    }
    .content-column .rhythm-lines::before,
    .content-column .rhythm-lines::after {
        filter: none !important;
    }

    .content-column::before,
    .content-column::after,
    .content-column .rhythm-lines::before,
    .content-column .rhythm-lines::after,
    .axis-node.active {
        animation: none !important;
    }
}

@media (max-width: 640px) {
    .brand-meta {
        position: static;
        align-items: flex-start;
        margin-top: 12px;
    }

    .settings-layout {
        display: block;
    }

    .sidebar {
        position: static;
        margin-bottom: 12px;
    }

    .nav-list {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 6px;
    }

    .nav-btn {
        width: auto;
        padding: 6px 10px;
        font-size: 13px;
    }

    .sidebar.compact {
        padding: 10px;
    }

    .sidebar.compact .nav-list {
        gap: 6px;
    }

    .sidebar.compact .nav-btn {
        padding: 6px 10px;
        font-size: 13px;
    }
    .nav-indicator {
        display: none;
    }
    .nav-subtext {
        display: none;
    }

    .session-pill {
        width: auto;
        max-width: 100%;
    }

    .session-user {
        max-width: 140px;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .section-label::before,
    .card .card-header::before {
        display: none;
    }
}
    
/* ---- Async switch stronger saving pulse + error wiggle ---- */
.switch.is-saving .slider {
  box-shadow:
    inset 0 0 0 1px rgba(79,70,229,0.34),
    0 0 0 8px rgba(79,70,229,0.10);
  animation:
    togglePulse 850ms ease-out infinite,
    savingGlow 1100ms ease-in-out infinite;
}
.switch.is-saving .slider:before {
  animation: thumbPulse 700ms ease-out infinite;
}
@keyframes savingGlow {
  0% { filter: saturate(1); }
  50% { filter: saturate(1.15); }
  100% { filter: saturate(1); }
}
@keyframes switchErrorWiggle {
  0% { transform: translateX(0); }
  20% { transform: translateX(-3px); }
  40% { transform: translateX(3px); }
  60% { transform: translateX(-2px); }
  80% { transform: translateX(2px); }
  100% { transform: translateX(0); }
}
.switch.is-error {
  animation: switchErrorWiggle 420ms ease-in-out;
}

/* ---- Toast ---- */
.toast-stack {
  position: fixed;
  right: 18px;
  bottom: 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 2000;
  pointer-events: none;
}
.toast {
  pointer-events: auto;
  min-width: 260px;
  max-width: 360px;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(17,24,39,0.92);
  color: #fff;
  border: 1px solid rgba(255,255,255,0.10);
  box-shadow: 0 14px 34px rgba(0,0,0,0.34);
  backdrop-filter: blur(8px);
  display: flex;
  gap: 10px;
  align-items: flex-start;
  transform: translateY(8px);
  opacity: 0;
  animation: toastIn 180ms ease-out forwards;
}
.toast .toast-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  margin-top: 4px;
  background: #ef4444;
  flex: 0 0 auto;
}
.toast .toast-title {
  font-weight: 700;
  font-size: 13px;
  line-height: 1.2;
  margin-bottom: 2px;
}
.toast .toast-body {
  font-size: 12px;
  line-height: 1.35;
  opacity: 0.92;
}
.toast .toast-close {
  margin-left: auto;
  background: transparent;
  border: none;
  color: rgba(255,255,255,0.75);
  cursor: pointer;
  padding: 2px 4px;
  border-radius: 8px;
}
.toast .toast-close:hover {
  color: #fff;
  background: rgba(255,255,255,0.08);
}
@keyframes toastIn {
  to { transform: translateY(0); opacity: 1; }
}
@keyframes toastOut {
  to { transform: translateY(8px); opacity: 0; }
}

/* Inline styles moved to CSS */
.brand-logo {
  opacity: 0.8;
}

.brand-title span:not(.brand-main) {
  opacity: 0.5;
}

.session-user {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.session-user svg,
.usage-line svg,
.state-chip svg,
.activity-list svg,
.email svg,
.btn-quiet svg,
.footer-right img {
  opacity: 0.75;
}

.usage-pill {
  padding-bottom: 12px;
}

.usage-line {
  align-items: center;
}

.plan-badge {
  display: inline-flex;
  align-items: center;
  padding: 1px 7px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  background: rgba(79,70,229,0.10);
  color: #4338ca;
  border: 1px solid rgba(79,70,229,0.22);
}

.state-chip.ok {
  gap: 8px;
  display: inline-flex;
  align-items: center;
}

.state-chip svg {
  opacity: 0.8;
}

.state-chip .separator {
  opacity: 0.45;
}

.state-chip .delivered-icon {
  opacity: 0.9;
  color: #22c55e;
}

.state-chip .delivered-text {
  color: #166534;
}

.state-chip .filtered-icon {
  opacity: 0.7;
  color: #6b7280;
}

.state-chip .filtered-text {
  color: #6b7280;
}

.state-chip .time-label {
  margin-left: 8px;
  font-size: 11px;
  color: #6b7280;
  opacity: 0.8;
}

.activity-list svg {
  opacity: 0.6;
}

.activity-done {
  color: #22c55e;
  font-weight: 600;
  margin-left: 6px;
}

.insight-chip.mt-sm {
  margin-top: 6px;
}

.activity-list.mt-sm {
  margin-top: 10px;
}

.row-between.mt-sm {
  margin-top: 6px;
}

.card-helper.no-margin {
  margin: 0;
}

.insight-chip.success {
  margin-top: 6px;
  background: rgba(34,197,94,0.08);
  border-color: rgba(34,197,94,0.22);
}

.insight-chip.success .insight-dot {
  background: #22c55e;
}

.danger-zone.compact {
  margin-top: 4px;
  padding-top: 0;
}

.danger-zone svg {
  opacity: 0.75;
}

.email {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.email svg {
  opacity: 0.7;
}

.btn-quiet {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.btn-quiet svg {
  opacity: 0.75;
}

.info-text {
  margin-top: 8px;
  font-size: 13px;
  color: #6b7280;
  margin-left: 6px;
}

.info-text-sm {
  margin-top: 6px;
  font-size: 13px;
  color: #6b7280;
  margin-left: 6px;
}

.info-text strong,
.info-text-sm strong {
  font-weight: 600;
}

.info-text svg,
.info-text-sm svg {
  opacity: 0.8;
}

.delivery-status {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
}

.delivery-status strong {
  font-weight: 600;
}

.disconnect-form {
  margin: 0;
}

.btn-danger.small {
  font-size: 10px;
  padding: 7px 9px;
}

.footer-links {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.footer-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.footer-logo-link {
  display: inline-flex;
  align-items: center;
}

.footer-logo {
  height: 36px;
  width: auto;
  display: block;
  transition: opacity .15s ease;
  opacity: 0.75;
}

.footer-logo:hover {
  opacity: 1;
}

.toast-content {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

/* SVG icons as images */
img[src$=".svg"] {
  display: inline-block;
  vertical-align: middle;
}

/* SVG icons as images */
img[src$=".svg"] {
  display: inline-block;
  vertical-align: middle;
}

.nav-icon,
.section-label-icon {
  display: inline-block;
  vertical-align: middle;
  flex-shrink: 0;
}

/* Ensure SVG images maintain aspect ratio */
img[src$=".svg"] {
  height: auto;
  max-width: 100%;
}
