﻿/* ═══════════════════════════════════════════════════════════════
   EngiGROUP — Глобальная дизайн-система
*/

/* ─────────────────────────────────────────────────────────────
   1. ДИЗАЙН-ТОКЕНЫ
   ───────────────────────────────────────────────────────────── */
:root {
    /* —— Поверхности —— */
    --ec-bg: #f5f5f7; /* фон страницы */
    --ec-bg-soft: #fafafc; /* мягкий вариант фона */
    --ec-surface: #ffffff; /* карточки, модалки */
    --ec-surface-2: #f0f0f3; /* вложенные блоки */
    --ec-grey-max: #e3e6e8; /* hover, тонкие подложки */
    /* —— Текст —— */
    --ec-text: #1d1d1f; /* основной */
    --ec-text-soft: #424245; /* под-заголовки */
    --ec-sub: #6e6e73; /* вторичный */
    --ec-muted: #86868b; /* служебный, captions */
    --ec-faint: #a1a1a6; /* placeholder, disabled */
    /* —— Границы —— */
    --ec-border: #d2d2d7; /* стандарт */
    --ec-border-soft: #e5e5ea; /* мягкая */
    --ec-border-strong: #a1a1a6; /* hover, фокус */
    /* —— Бренд + акценты —— */
    --ec-accent: #0071e3; /* Apple-blue, основной CTA */
    --ec-accent-h: #0077ed; /* hover */
    --ec-accent-deep: #1d4ed8; /* глубокий — для авторизованной зоны */
    --ec-accent-soft: #e8f0fb; /* фон-плашки */
    /* —— Инженерные акценты (для бейджей, навигации) —— */
    --ec-steel: #5a6e80; /* стальной */
    --ec-steel-deep: #1e2d3d; /* navy для боковой панели */
    --ec-steel-soft: #e8eef3; /* фон под steel */
    /* —— Семантика —— */
    --ec-success: #34c759;
    --ec-success-bg: #d1fae5;
    --ec-success-text: #065f46;
    --ec-warning: #ff9500;
    --ec-warning-bg: #fff4e0;
    --ec-warning-text: #9a3412;
    --ec-danger: #ff3b30;
    --ec-danger-bg: #fee2e2;
    --ec-danger-text: #991b1b;
    --ec-info: #5ac8fa;
    --ec-info-bg: #dbeafe;
    --ec-info-text: #1e40af;
    /* —— Уровни верификации —— */
    --ec-verify-1-bg: #dde2e8;
    --ec-verify-1-text: #5a6e80;
    --ec-verify-2-bg: #d1fae5;
    --ec-verify-2-text: #065f46;
    --ec-verify-3-bg: #fef3c7;
    --ec-verify-3-text: #92400e;
    /* —— Радиусы —— */
    --ec-r-xs: 6px;
    --ec-r-sm: 10px;
    --ec-r-md: 14px;
    --ec-r-lg: 18px;
    --ec-r-xl: 24px;
    --ec-r-pill: 980px;
    /* —— Тени (мягкие, не «карточные») —— */
    --ec-shadow-sm: 0 1px 2px rgba(0, 0, 0, .04);
    --ec-shadow: 0 4px 24px rgba(0, 0, 0, .06);
    --ec-shadow-md: 0 8px 40px rgba(0, 0, 0, .10);
    --ec-shadow-lg: 0 20px 60px rgba(0, 0, 0, .14);
    --ec-shadow-accent: 0 8px 32px rgba(0, 113, 227, .22);
    /* —— Контейнеры (расширение по ТЗ) —— */
    --ec-container-narrow: 760px; /* для лендингов центрированный */
    --ec-container-text: 980px; /* для статей, About */
    --ec-container: 1240px; /* стандарт авторизованной зоны */
    --ec-container-wide: 1440px; /* dashboard, Feed, Messages */
    /* —— Шрифты —— */
    --ec-font-sans: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Inter', 'Helvetica Neue', Arial, 'PT Sans', sans-serif;
    --ec-font-mono: 'SF Mono', 'JetBrains Mono', Consolas, Menlo, monospace;
    /* —— Анимации —— */
    --ec-ease: cubic-bezier(.4, 0, .2, 1);
    --ec-ease-out: cubic-bezier(.16, 1, .3, 1);
    --ec-ease-soft: cubic-bezier(.4, 0, .6, 1);
    --ec-dur-fast: 150ms;
    --ec-dur: 220ms;
    --ec-dur-slow: 400ms;
    /* —— Z-index —— */
    --ec-z-nav: 100;
    --ec-z-sticky: 90;
    --ec-z-popover: 1000;
    --ec-z-modal: 2000;
    --ec-z-toast: 3000;

}

/* ─────────────────────────────────────────────────────────────
   2. RESET / БАЗА
   ───────────────────────────────────────────────────────────── */
*, *::before, *::after {
    box-sizing: border-box;
}

html {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

body {
    font-family: var(--ec-font-sans);
    color: var(--ec-text);
    background: var(--ec-bg);
    margin: 0;
}

h1:focus {
    outline: none;
}
/* остаток шаблона Blazor */
button {
    font-family: inherit;
}

img {
    max-width: 100%;
    display: block;
}

svg {
    max-width: 100%;
}

/* —— Скроллбар —— */
.scroll-thin::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

.scroll-thin::-webkit-scrollbar-track {
    background: transparent;
}

.scroll-thin::-webkit-scrollbar-thumb {
    background: var(--ec-border);
    border-radius: 3px;
}

    .scroll-thin::-webkit-scrollbar-thumb:hover {
        background: var(--ec-faint);
    }

/* —— Уважение к prefers-reduced-motion —— */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .01ms !important;
        scroll-behavior: auto !important;
    }
}

/* ─────────────────────────────────────────────────────────────
   3. КОНТЕЙНЕРЫ
   ───────────────────────────────────────────────────────────── */
.ec-container {
    max-width: var(--ec-container);
    margin: 0 auto;
    padding: 0 24px;
    width: 100%;
}

.ec-container-wide {
    max-width: var(--ec-container-wide);
    margin: 0 auto;
    padding: 0 24px;
    width: 100%;
}

.ec-container-text {
    max-width: var(--ec-container-text);
    margin: 0 auto;
    padding: 0 24px;
    width: 100%;
}

.ec-container-narrow {
    max-width: var(--ec-container-narrow);
    margin: 0 auto;
    padding: 0 16px;
    width: 100%;
}

@media (max-width: 640px) {
    .ec-container, .ec-container-wide, .ec-container-text {
        padding: 0 16px;
    }
}

/* ─────────────────────────────────────────────────────────────
   4. ТИПОГРАФИКА
   ───────────────────────────────────────────────────────────── */
.ec-eyebrow {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: var(--ec-muted);
    margin: 0 0 8px;
}

.ec-title-1 {
    font-size: clamp(40px, 6vw, 64px);
    font-weight: 700;
    letter-spacing: -.04em;
    line-height: 1.05;
    color: var(--ec-text);
    margin: 0;
}

.ec-title-2 {
    font-size: clamp(28px, 4vw, 40px);
    font-weight: 700;
    letter-spacing: -.03em;
    line-height: 1.15;
    color: var(--ec-text);
    margin: 0;
}

.ec-title-3 {
    font-size: clamp(22px, 3vw, 28px);
    font-weight: 700;
    letter-spacing: -.02em;
    line-height: 1.25;
    color: var(--ec-text);
    margin: 0;
}

.ec-title-4 {
    font-size: 18px;
    font-weight: 600;
    letter-spacing: -.01em;
    color: var(--ec-text);
    margin: 0;
}

.ec-text {
    font-size: 15px;
    color: var(--ec-text);
    line-height: 1.6;
    margin: 0;
}

.ec-text-sub {
    font-size: 14px;
    color: var(--ec-sub);
    line-height: 1.6;
    margin: 0;
}

.ec-caption {
    font-size: 12px;
    color: var(--ec-muted);
    line-height: 1.5;
    margin: 0;
}

/* Градиентный заголовок (для hero) */
.ec-title-gradient {
    background: linear-gradient(135deg, var(--ec-text) 40%, var(--ec-sub) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.ec-title-gradient-accent {
    background: linear-gradient(135deg, var(--ec-accent), #34aadc);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* ─────────────────────────────────────────────────────────────
   5. КАРТОЧКИ
   ───────────────────────────────────────────────────────────── */
.ec-card {
    background: var(--ec-surface);
    border: 1px solid var(--ec-border);
    border-radius: var(--ec-r-lg);
    padding: 24px;
    transition: box-shadow var(--ec-dur) var(--ec-ease), border-color var(--ec-dur) var(--ec-ease), transform var(--ec-dur) var(--ec-ease);
}

.ec-card--hover:hover {
    box-shadow: var(--ec-shadow-md);
    border-color: var(--ec-border-strong);
    transform: translateY(-2px);
}

.ec-card--soft {
    background: var(--ec-bg-soft);
}

.ec-card--inset {
    background: var(--ec-grey-max);
    border-color: transparent;
}

.ec-card--interactive {
    cursor: pointer;
}

.ec-card--compact {
    padding: 16px;
    border-radius: var(--ec-r-md);
}

.ec-card--lg {
    padding: 32px;
    border-radius: var(--ec-r-xl);
}

/* ─────────────────────────────────────────────────────────────
   6. КНОПКИ
   ───────────────────────────────────────────────────────────── */
.ec-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    line-height: 1;
    letter-spacing: -.01em;
    padding: 10px 18px;
    border-radius: var(--ec-r-pill);
    border: 1.5px solid transparent;
    cursor: pointer;
    user-select: none;
    text-decoration: none;
    transition: background var(--ec-dur-fast) var(--ec-ease), border-color var(--ec-dur-fast) var(--ec-ease), transform var(--ec-dur-fast) var(--ec-ease), box-shadow var(--ec-dur-fast) var(--ec-ease), color var(--ec-dur-fast) var(--ec-ease);
}

    .ec-btn:focus-visible {
        outline: 2px solid var(--ec-accent);
        outline-offset: 2px;
    }

    .ec-btn:disabled, .ec-btn[aria-disabled="true"] {
        opacity: .5;
        cursor: not-allowed;
        pointer-events: none;
    }

/* —— Variants —— */
.ec-btn-primary {
    background: var(--ec-accent);
    color: #fff;
    box-shadow: 0 2px 12px rgba(0,113,227,.25);
}

    .ec-btn-primary:hover {
        background: var(--ec-accent-h);
        transform: translateY(-1px);
        box-shadow: var(--ec-shadow-accent);
    }

.ec-btn-ghost {
    background: transparent;
    color: var(--ec-text);
    border-color: var(--ec-border);
}

    .ec-btn-ghost:hover {
        background: var(--ec-grey-max);
        border-color: var(--ec-border-strong);
        transform: translateY(-1px);
    }

.ec-btn-outline {
    background: transparent;
    color: var(--ec-text);
    border-color: var(--ec-border);
}

    .ec-btn-outline:hover {
        background: var(--ec-grey-max);
    }

.ec-btn-secondary {
    background: transparent;
    color: var(--ec-sub);
    border-color: var(--ec-border);
}

    .ec-btn-secondary:hover {
        background: var(--ec-grey-max);
        border-color: var(--ec-sub);
        color: var(--ec-text);
    }

.ec-btn-danger {
    background: var(--ec-danger);
    color: #fff;
}

    .ec-btn-danger:hover {
        background: #e53026;
    }

.ec-btn-text {
    background: transparent;
    padding: 6px 10px;
    color: var(--ec-accent);
}

    .ec-btn-text:hover {
        color: var(--ec-accent-h);
    }

/* —— Sizes —— */
.ec-btn-sm {
    font-size: 13px;
    padding: 7px 14px;
}

.ec-btn-lg {
    font-size: 16px;
    padding: 14px 28px;
}

.ec-btn-xl {
    font-size: 17px;
    padding: 16px 36px;
}

.ec-btn-icon {
    width: 36px;
    height: 36px;
    padding: 0;
    border-radius: var(--ec-r-md);
}

.ec-btn-icon-sm {
    width: 28px;
    height: 28px;
    border-radius: var(--ec-r-sm);
}

/* ─────────────────────────────────────────────────────────────
   7. БЕЙДЖИ / ТЕГИ / ЧИПЫ
   ───────────────────────────────────────────────────────────── */
.ec-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .02em;
    padding: 3px 10px;
    border-radius: var(--ec-r-pill);
    background: var(--ec-grey-max);
    color: var(--ec-sub);
    border: 1px solid var(--ec-border-soft);
    white-space: nowrap;
}

.ec-badge--success {
    background: var(--ec-success-bg);
    color: var(--ec-success-text);
    border-color: transparent;
}

.ec-badge--warning {
    background: var(--ec-warning-bg);
    color: var(--ec-warning-text);
    border-color: transparent;
}

.ec-badge--danger {
    background: var(--ec-danger-bg);
    color: var(--ec-danger-text);
    border-color: transparent;
}

.ec-badge--info {
    background: var(--ec-info-bg);
    color: var(--ec-info-text);
    border-color: transparent;
}

.ec-badge--accent {
    background: var(--ec-accent-soft);
    color: var(--ec-accent-deep);
    border-color: transparent;
}

.ec-badge--solid {
    background: var(--ec-text);
    color: #fff;
    border-color: transparent;
}

.ec-badge--lg {
    font-size: 12px;
    padding: 5px 14px;
}

.ec-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    font-weight: 500;
    background: var(--ec-surface);
    color: var(--ec-text);
    border: 1px solid var(--ec-border);
    padding: 6px 14px;
    border-radius: var(--ec-r-pill);
    transition: background var(--ec-dur-fast) var(--ec-ease), border-color var(--ec-dur-fast) var(--ec-ease);
}

    .ec-chip:hover {
        background: var(--ec-grey-max);
        border-color: var(--ec-border-strong);
    }

.ec-chip--active {
    background: var(--ec-text);
    color: #fff;
    border-color: var(--ec-text);
}

/* ─────────────────────────────────────────────────────────────
   8. ИКОНКИ (хост для <EcIcon>)
   ───────────────────────────────────────────────────────────── */
.ec-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    vertical-align: middle;
    color: currentColor;
}

    .ec-icon svg {
        width: 1em;
        height: 1em;
        stroke: currentColor;
        fill: none;
    }

.ec-icon-12 {
    font-size: 12px;
}

.ec-icon-14 {
    font-size: 14px;
}

.ec-icon-16 {
    font-size: 16px;
}

.ec-icon-18 {
    font-size: 18px;
}

.ec-icon-20 {
    font-size: 20px;
}

.ec-icon-22 {
    font-size: 22px;
}

.ec-icon-24 {
    font-size: 24px;
}

.ec-icon-28 {
    font-size: 28px;
}

.ec-icon-32 {
    font-size: 32px;
}

.ec-icon-40 {
    font-size: 40px;
}

/* «Карта» иконки — иконка в квадратной плашке с обводкой */
.ec-icon-tile {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    background: var(--ec-surface);
    border: 1px solid var(--ec-border);
    border-radius: var(--ec-r-md);
    color: var(--ec-text);
}

.ec-icon-tile--sm {
    width: 32px;
    height: 32px;
    border-radius: var(--ec-r-sm);
}

.ec-icon-tile--lg {
    width: 56px;
    height: 56px;
    border-radius: var(--ec-r-lg);
}

.ec-icon-tile--accent {
    background: var(--ec-accent-soft);
    color: var(--ec-accent-deep);
    border-color: transparent;
}

.ec-icon-tile--steel {
    background: var(--ec-steel-soft);
    color: var(--ec-steel-deep);
    border-color: transparent;
}

/* ─────────────────────────────────────────────────────────────
   9. ИНПУТЫ И ФОРМЫ
   ───────────────────────────────────────────────────────────── */
.ec-input,
.ec-textarea,
.ec-select {
    width: 100%;
    font-family: inherit;
    font-size: 14px;
    color: var(--ec-text);
    background: var(--ec-surface);
    border: 1px solid var(--ec-border);
    border-radius: var(--ec-r-md);
    padding: 10px 14px;
    transition: border-color var(--ec-dur-fast) var(--ec-ease), box-shadow var(--ec-dur-fast) var(--ec-ease), background var(--ec-dur-fast) var(--ec-ease);
}

    .ec-input::placeholder,
    .ec-textarea::placeholder {
        color: var(--ec-faint);
    }

    .ec-input:focus,
    .ec-textarea:focus,
    .ec-select:focus {
        outline: none;
        border-color: var(--ec-accent);
        box-shadow: 0 0 0 4px rgba(0, 113, 227, .12);
    }

.ec-textarea {
    resize: vertical;
    min-height: 96px;
    line-height: 1.55;
}

.ec-label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--ec-text-soft);
    margin-bottom: 6px;
    letter-spacing: .01em;
}

.ec-helper {
    font-size: 11px;
    color: var(--ec-muted);
    margin-top: 4px;
}

/* Стили валидации Blazor */
.valid.modified:not([type=checkbox]) {
    border-color: var(--ec-success);
    box-shadow: 0 0 0 3px rgba(52, 199, 89, .12);
}

.invalid {
    border-color: var(--ec-danger);
    box-shadow: 0 0 0 3px rgba(255, 59, 48, .12);
}

.validation-message {
    color: var(--ec-danger);
    font-size: 12px;
    margin-top: 4px;
}

/* ─────────────────────────────────────────────────────────────
   10. СЕТКИ И SPACING
   ───────────────────────────────────────────────────────────── */
.ec-stack {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.ec-stack-sm {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.ec-stack-lg {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.ec-row {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.ec-row-tight {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.ec-row-between {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.ec-grid-2 {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}

.ec-grid-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}

.ec-grid-4 {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 14px;
}

@media (max-width: 900px) {
    .ec-grid-3, .ec-grid-4 {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 540px) {
    .ec-grid-2, .ec-grid-3, .ec-grid-4 {
        grid-template-columns: 1fr;
    }
}

.ec-section {
    padding: 80px 0;
}

.ec-section--sm {
    padding: 48px 0;
}

.ec-section--lg {
    padding: 120px 0;
}

.ec-section--alt {
    background: var(--ec-surface);
}

.ec-divider {
    height: 1px;
    background: var(--ec-border);
    border: 0;
    margin: 24px 0;
}

/* ─────────────────────────────────────────────────────────────
   11. АНИМАЦИИ
   ───────────────────────────────────────────────────────────── */
@keyframes ec-fade-in {
    from {
        opacity: 0;
        transform: translateY(4px);
    }

    to {
        opacity: 1;
        transform: none;
    }
}

@keyframes ec-fade-up {
    from {
        opacity: 0;
        transform: translateY(16px);
    }

    to {
        opacity: 1;
        transform: none;
    }
}

@keyframes ec-float {
    0%,100% {
        transform: translateY(0) scale(1);
    }

    50% {
        transform: translateY(-28px) scale(1.04);
    }
}

@keyframes ec-pulse-soft {
    0%,100% {
        opacity: .55;
    }

    50% {
        opacity: 1;
    }
}

@keyframes ec-pulse-ring {
    0%,100% {
        box-shadow: 0 0 0 0 rgba(52,199,89,.7);
    }

    50% {
        box-shadow: 0 0 0 6px rgba(52,199,89,0);
    }
}

@keyframes ec-shimmer {
    0% {
        background-position: -200% 0;
    }

    100% {
        background-position: 200% 0;
    }
}

@keyframes ec-spin {
    to {
        transform: rotate(360deg);
    }
}

.ec-animate-fade {
    animation: ec-fade-in var(--ec-dur) var(--ec-ease-out) both;
}

.ec-animate-up {
    animation: ec-fade-up var(--ec-dur-slow) var(--ec-ease-out) both;
}

.ec-animate-float {
    animation: ec-float 9s var(--ec-ease-soft) infinite;
}

.ec-pulse-online {
    animation: ec-pulse-ring 2s infinite;
}

/* Совместимость со старыми классами */
.fade-in {
    animation: ec-fade-in var(--ec-dur) var(--ec-ease-out) both;
}

.pulse-online {
    animation: ec-pulse-ring 2s infinite;
}

/* ─────────────────────────────────────────────────────────────
   12. ДЫШАЩИЕ ОРБЫ ДЛЯ HERO
   ───────────────────────────────────────────────────────────── */
.ec-orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: .45;
    pointer-events: none;
}

.ec-orb-1 {
    width: 520px;
    height: 520px;
    background: radial-gradient(circle, #c7e0ff 0%, transparent 70%);
    top: -120px;
    left: -80px;
    animation: ec-float 8s var(--ec-ease-soft) infinite;
}

.ec-orb-2 {
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, #dde8f5 0%, transparent 70%);
    bottom: -60px;
    right: -60px;
    animation: ec-float 10s var(--ec-ease-soft) infinite reverse;
}

.ec-orb-3 {
    width: 320px;
    height: 320px;
    background: radial-gradient(circle, #e8eef3 0%, transparent 70%);
    top: 40%;
    left: 40%;
    animation: ec-float 12s var(--ec-ease-soft) infinite;
}

/* ─────────────────────────────────────────────────────────────
   13. ВЕРХНЯЯ ПУБЛИЧНАЯ НАВИГАЦИЯ (frosted glass)
   ───────────────────────────────────────────────────────────── */
.ec-pub-nav {
    position: sticky;
    top: 0;
    z-index: var(--ec-z-nav);
    background: rgba(245, 245, 247, .82);
    backdrop-filter: saturate(180%) blur(20px);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    border-bottom: 1px solid var(--ec-border);
}

.ec-pub-nav-inner {
    max-width: var(--ec-container);
    margin: 0 auto;
    padding: 0 16px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    flex-wrap: nowrap;
    overflow: hidden;
}

.ec-pub-nav-logo {
    font-size: 18px;
    font-weight: 700;
    letter-spacing: -.04em;
    color: var(--ec-text);
    text-decoration: none;
}

    .ec-pub-nav-logo span {
        color: var(--ec-accent);
    }

.ec-pub-nav-links {
    display: flex;
    align-items: center;
    gap: 4px;
}

.ec-pub-nav-link {
    font-size: 13px;
    color: var(--ec-sub);
    padding: 7px 14px;
    border-radius: var(--ec-r-sm);
    text-decoration: none;
    white-space: nowrap;
    transition: background var(--ec-dur-fast) var(--ec-ease), color var(--ec-dur-fast) var(--ec-ease);
}

    .ec-pub-nav-link:hover {
        background: var(--ec-grey-max);
        color: var(--ec-text);
    }

.ec-pub-nav-cta {
    font-size: 13px;
    font-weight: 500;
    color: var(--ec-text);
    text-decoration: none;
    padding: 7px 18px;
    border-radius: var(--ec-r-pill);
    border: 1.5px solid var(--ec-border);
    white-space: nowrap;
    flex-shrink: 0; 
    transition: background var(--ec-dur-fast) var(--ec-ease), border-color var(--ec-dur-fast) var(--ec-ease);
}

    .ec-pub-nav-cta:hover {
        background: var(--ec-grey-max);
        border-color: var(--ec-border-strong);
    }

@media (max-width: 480px) {
    .ec-pub-nav-link {
        font-size: 12px;
        padding: 6px 8px;
    }

    .ec-pub-nav-cta {
        font-size: 12px;
        padding: 6px 12px;
    }

    .ec-pub-nav-logo {
        font-size: 16px;
        flex-shrink: 0;
    }
}

/* ─────────────────────────────────────────────────────────────
   14. БОКОВАЯ НАВИГАЦИЯ (авторизованная зона) — светлая Apple-like
   ───────────────────────────────────────────────────────────── */
.ec-side-nav {
    width: 256px;
    min-height: 100vh;
    background: var(--ec-surface);
    color: var(--ec-text);
    border-right: 1px solid var(--ec-border);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    z-index: var(--ec-z-nav);
    transition: transform var(--ec-dur-slow) var(--ec-ease-out);
}

/* —— Бренд —— */
.ec-side-nav-brand {
    padding: 18px 22px 16px;
    border-bottom: 1px solid var(--ec-border-soft);
}

.ec-side-nav-brand-logo {
    font-size: 20px;
    font-weight: 800;
    letter-spacing: -.04em;
    color: var(--ec-text);
    text-decoration: none;
    display: inline-flex;
    align-items: baseline;
    gap: 0;
}

    .ec-side-nav-brand-logo span {
        color: var(--ec-accent);
    }

.ec-side-nav-brand-tag {
    font-size: 10px;
    letter-spacing: .12em;
    text-transform: uppercase;
    color: var(--ec-muted);
    margin-top: 2px;
    display: block;
}

/* —— Списки и заголовки секций —— */
.ec-side-nav-list {
    flex: 1;
    overflow-y: auto;
    padding: 12px 12px 16px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.ec-side-nav-section-title {
    padding: 14px 12px 6px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .12em;
    text-transform: uppercase;
    color: var(--ec-muted);
}

/* —— Ссылки —— */
.ec-side-nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: var(--ec-r-sm);
    color: var(--ec-sub);
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    transition: background var(--ec-dur-fast) var(--ec-ease), color var(--ec-dur-fast) var(--ec-ease);
    white-space: nowrap;
}

    .ec-side-nav-link:hover {
        background: var(--ec-grey-max);
        color: var(--ec-text);
    }

    .ec-side-nav-link.ec-side-nav-link--active,
    .ec-side-nav-link.active {
        background: var(--ec-accent-soft);
        color: var(--ec-accent-deep);
        font-weight: 600;
    }

    .ec-side-nav-link .ec-icon {
        color: var(--ec-muted);
        transition: color var(--ec-dur-fast) var(--ec-ease);
    }

    .ec-side-nav-link:hover .ec-icon {
        color: var(--ec-text);
    }

    .ec-side-nav-link.ec-side-nav-link--active .ec-icon,
    .ec-side-nav-link.active .ec-icon {
        color: var(--ec-accent);
    }

.ec-side-nav-link-label {
    flex: 1;
}

.ec-side-nav-link-badge {
    min-width: 22px;
    height: 22px;
    padding: 0 6px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--ec-danger);
    color: #fff;
    border-radius: var(--ec-r-pill);
    font-size: 11px;
    font-weight: 700;
}

/* —— Подвал боковой —— */
.ec-side-nav-footer {
    padding: 14px 16px 18px;
    border-top: 1px solid var(--ec-border-soft);
}

/* —— Мобильный header (виден только на <1024px) —— */
.ec-mobile-header {
    display: none;
}

.ec-side-nav-overlay {
    display: none;
}

/* ═══════════════════════════════════════════════════════════════
   МОБИЛЬНАЯ НАВИГАЦИЯ (≤1023px) — drawer slide-from-left
   ═══════════════════════════════════════════════════════════════ */
@media (max-width: 1023px) {

    /* —— Сайдбар становится drawer-ом —— */
    .ec-side-nav {
        width: 86vw;
        max-width: 320px;
        transform: translateX(-105%);
        box-shadow: 12px 0 40px rgba(0, 0, 0, .25);
        transition: transform .32s cubic-bezier(.16, 1, .3, 1);
        will-change: transform;
        z-index: calc(var(--ec-z-nav) + 2);
    }

        .ec-side-nav.ec-side-nav--open {
            transform: translateX(0);
        }

    /* —— Мобильный header (фикс, не sticky) —— */
    .ec-mobile-header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        height: 56px;
        padding: 0 12px 0 14px;
        padding-top: env(safe-area-inset-top, 0px);
        height: calc(56px + env(safe-area-inset-top, 0px));
        background: rgba(255, 255, 255, .88);
        backdrop-filter: saturate(180%) blur(16px);
        -webkit-backdrop-filter: saturate(180%) blur(16px);
        border-bottom: 1px solid var(--ec-border);
        z-index: var(--ec-z-nav); 
        gap: 8px;
    }

    .ec-mobile-header-logo {
        font-size: 18px;
        font-weight: 800;
        letter-spacing: -.04em;
        color: var(--ec-text);
        text-decoration: none;
        flex: 1;
        min-width: 0;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

        .ec-mobile-header-logo span {
            color: var(--ec-accent);
        }

    /* —— Группа кнопок справа: единый блок без зазоров —— */
    .ec-mobile-header-actions {
        display: inline-flex;
        align-items: center;
        gap: 2px;
        flex-shrink: 0;
    }

    .ec-mobile-header-action {
        position: relative;
        width: 40px;
        height: 40px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        border-radius: 10px;
        color: var(--ec-sub);
        text-decoration: none;
        background: transparent;
        border: none;
        cursor: pointer;
        transition: background var(--ec-dur-fast) var(--ec-ease), color var(--ec-dur-fast) var(--ec-ease);
    }

        .ec-mobile-header-action:hover,
        .ec-mobile-header-action:active {
            background: var(--ec-grey-max);
            color: var(--ec-text);
        }

        /* —— Активная кнопка-меню при открытом drawer —— */
        .ec-mobile-header-action.is-active {
            background: var(--ec-accent-soft);
            color: var(--ec-accent-deep);
        }

    .ec-mobile-header-action-badge {
        position: absolute;
        top: 6px;
        right: 6px;
        min-width: 16px;
        height: 16px;
        padding: 0 4px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        background: var(--ec-danger);
        color: #fff;
        border-radius: var(--ec-r-pill);
        font-size: 9px;
        font-weight: 700;
        border: 1.5px solid #fff;
    }

    /* —— Затемнение позади drawer-а — всегда в DOM, управляется opacity —— */
    .ec-side-nav-overlay {
        display: block;
        position: fixed;
        inset: 0;
        z-index: calc(var(--ec-z-nav) + 1); /* выше header (100) */
        background: rgba(15, 23, 35, .46);
        backdrop-filter: blur(3px);
        -webkit-backdrop-filter: blur(3px);
        opacity: 0;
        pointer-events: none;
        transition: opacity .32s cubic-bezier(.16, 1, .3, 1);
    }

    .ec-side-nav-overlay.ec-side-nav-overlay--visible {
        opacity: 1;
        pointer-events: auto;
    }

    /* —— Блокировка скролла body при открытом меню —— */
    body.ec-menu-open {
        overflow: hidden;
        touch-action: none;
    }

    /* —— Контент полностью без сдвига —— */
    .ec-layout-content {
        margin-left: 0;
        width: 100%;
        max-width: 100%;
        padding-top: calc(56px + env(safe-area-inset-top, 0px));
    }

    .ec-layout-main {
        padding: 18px 14px 32px;
    }
}

/* ═══════════════════════════════════════════════════════════════
   ЛАНДШАФТ + узкая высота: уменьшаем header, плотнее списки
   ═══════════════════════════════════════════════════════════════ */
@media (max-width: 1023px) and (orientation: landscape) and (max-height: 500px) {
    .ec-mobile-header {
        height: 48px;
    }

    .ec-mobile-header-action {
        width: 36px;
        height: 36px;
    }

    .ec-side-nav-brand {
        padding: 12px 18px 10px;
    }

    .ec-side-nav-list {
        padding: 8px 10px 12px;
        gap: 1px;
    }

    .ec-side-nav-link {
        padding: 8px 12px;
        font-size: 13px;
    }
}

/* ═══════════════════════════════════════════════════════════════
   ОЧЕНЬ УЗКИЕ ЭКРАНЫ (<360px) — iPhone SE, бюджетные Android
   ═══════════════════════════════════════════════════════════════ */
@media (max-width: 360px) {
    .ec-mobile-header {
        padding: 0 8px;
    }

    .ec-mobile-header-action {
        width: 38px;
        height: 38px;
    }

    .ec-mobile-header-logo {
        font-size: 16px;
    }

    .ec-layout-main {
        padding: 14px 12px 28px;
    }
}

/* ─── Layout с сайдбаром ──────────────────────────────── */
.ec-layout-shell {
    display: flex;
    min-height: 100vh;
    background: var(--ec-bg);
}

@media (max-width: 1023px) {
    .ec-layout-shell {
        flex-direction: column;
        width: 100%;
        max-width: 100vw;
    }
}
html:has(body.ec-menu-open) {
    overflow: hidden;
}

.ec-layout-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    margin-left: 256px; /* desktop: место под фикс-сайдбар */
    transition: margin-left var(--ec-dur-slow) var(--ec-ease-out);
}

@media (max-width: 1023px) {
    .ec-layout-content {
        margin-left: 0;
    }
}

.ec-layout-main {
    flex: 1;
    width: 100%;
    max-width: var(--ec-container-wide); /* 1440px */
    margin: 0 auto;
    padding: 28px 24px 48px;
}

@media (max-width: 768px) {
    .ec-layout-main {
        padding: 16px 14px calc(32px + env(safe-area-inset-bottom, 0px));
    }
}

/* ─────────────────────────────────────────────────────────────
   15. АВАТАРЫ
   ───────────────────────────────────────────────────────────── */
.ec-avatar {
    position: relative;
    flex-shrink: 0;
    background: var(--ec-grey-max);
    border-radius: 50%;
    overflow: hidden;
    border: 1px solid var(--ec-border);
}

    .ec-avatar img {
        width: 100%;
        height: 100%;
        object-fit: cover;
    }

.ec-avatar--rect-3-4 {
    border-radius: var(--ec-r-md);
    aspect-ratio: 3 / 4;
    width: 100%;
}

.ec-avatar--initials {
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--ec-steel);
    color: #fff;
    font-weight: 700;
    letter-spacing: -.02em;
}

.ec-avatar-img-rect {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 12px;
}

.ec-avatar-fallback--rect {
    width: 100%;
    height: 100%;
    border-radius: 12px;
}

/* ─────────────────────────────────────────────────────────────
   16. ПУЗЫРИ ЧАТА (legacy совместимость)
   ───────────────────────────────────────────────────────────── */
.msg-bubble {
    max-width: 78%;
    padding: 10px 14px;
    border-radius: var(--ec-r-lg);
    word-break: break-word;
    font-size: 14px;
    line-height: 1.5;
}

    .msg-bubble.me {
        background: var(--ec-text);
        color: #fff;
        border-bottom-right-radius: 4px;
    }

    .msg-bubble.them {
        background: var(--ec-grey-max);
        color: var(--ec-text);
        border-bottom-left-radius: 4px;
    }

.tick-sent, .tick-delivered {
    color: var(--ec-faint);
}

.tick-read {
    color: var(--ec-success);
}

/* ─────────────────────────────────────────────────────────────
   17. AUTOCOMPLETE DROPDOWN (legacy совместимость)
   ───────────────────────────────────────────────────────────── */
.autocomplete-dropdown {
    position: absolute;
    left: 0;
    right: 0;
    top: 100%;
    background: var(--ec-surface);
    border: 1px solid var(--ec-border);
    border-radius: var(--ec-r-md);
    box-shadow: var(--ec-shadow-md);
    max-height: 280px;
    overflow-y: auto;
    z-index: var(--ec-z-popover);
    margin-top: 4px;
}

.autocomplete-item {
    padding: 10px 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: background var(--ec-dur-fast) var(--ec-ease);
}

    .autocomplete-item:hover,
    .autocomplete-item.active {
        background: var(--ec-grey-max);
    }

/* ─────────────────────────────────────────────────────────────
   18. ОШИБКА BLAZOR
   ───────────────────────────────────────────────────────────── */
.blazor-error-boundary {
    background: var(--ec-danger);
    color: #fff;
    padding: 14px 18px 14px 50px;
    border-radius: var(--ec-r-md);
    margin: 16px;
}

    .blazor-error-boundary::after {
        content: "Произошла ошибка.";
    }

/* ─────────────────────────────────────────────────────────────
   19. РЕДАКТОР ЗАМЕТОК (legacy)
   ───────────────────────────────────────────────────────────── */
[id^="note-editor-"] ul, [id^="note-editor-"] ol {
    padding-left: 1.6em;
    margin: .8em 0;
}

[id^="note-editor-"] ul {
    list-style-type: disc;
}

[id^="note-editor-"] ol {
    list-style-type: decimal;
}

[id^="note-editor-"] li {
    margin: .35em 0;
    padding-left: .3em;
}

[id^="note-editor-"] ul ul, [id^="note-editor-"] ol ol,
[id^="note-editor-"] ul ol, [id^="note-editor-"] ol ul {
    margin-top: .4em;
    margin-bottom: .4em;
}

/* ─────────────────────────────────────────────────────────────
   20. COOKIE-БАННЕР
   ───────────────────────────────────────────────────────────── */
.ec-cookie-banner {
    position: fixed;
    left: 16px;
    right: 16px;
    bottom: 16px;
    z-index: var(--ec-z-toast);
    max-width: 720px;
    margin: 0 auto;
    background: var(--ec-surface);
    border: 1px solid var(--ec-border);
    border-radius: var(--ec-r-lg);
    box-shadow: var(--ec-shadow-lg);
    padding: 18px 22px;
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
    animation: ec-fade-up var(--ec-dur-slow) var(--ec-ease-out) both;
}

.ec-cookie-banner-text {
    flex: 1;
    min-width: 240px;
    font-size: 13px;
    color: var(--ec-sub);
    line-height: 1.55;
}

    .ec-cookie-banner-text a {
        color: var(--ec-accent);
        text-decoration: none;
    }

        .ec-cookie-banner-text a:hover {
            text-decoration: underline;
        }

.ec-cookie-banner-actions {
    display: flex;
    gap: 8px;
}

/* ─────────────────────────────────────────────────────────────
   21. УТИЛИТЫ
   ───────────────────────────────────────────────────────────── */
.ec-truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ec-clamp-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.ec-clamp-3 {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.ec-sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0,0,0,0);
    white-space: nowrap;
    border: 0;
}

.ec-pointer {
    cursor: pointer;
}

.ec-no-select {
    user-select: none;
}

.ec-text-accent {
    color: var(--ec-accent);
}

.ec-text-sub {
    color: var(--ec-sub);
}

.ec-text-muted {
    color: var(--ec-muted);
}

.ec-bg-surface {
    background: var(--ec-surface);
}

.ec-bg-soft {
    background: var(--ec-bg-soft);
}

.ec-relative {
    position: relative;
}

.ec-flex-1 {
    flex: 1 1 auto;
    min-width: 0;
}

.ec-icon svg {
    display: inline-block;
    width: 1em;
    height: 1em;
    flex-shrink: 0;
}

/* ─────────────────────────────────────────────────────────────
   22. AUTH-СТРАНИЦЫ (Login, Register, SetupProfile)
   ───────────────────────────────────────────────────────────── */

/* —— Page wrapper —— */
.ec-auth-page {
    min-height: calc(100vh - 56px);
    background: var(--ec-bg);
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 56px 16px 80px;
    overflow: hidden;
}

.ec-auth-shell {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 460px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.ec-auth-card {
    width: 100%;
    padding: 0;
    overflow: hidden;
}

/* —— Header —— */
.ec-auth-header {
    text-align: center;
    padding: 36px 36px 8px;
}

.ec-auth-logo {
    font-size: 34px;
    font-weight: 800;
    letter-spacing: -.04em;
    line-height: 1;
    color: var(--ec-text);
    margin: 8px 0 0;
}

    .ec-auth-logo span {
        color: var(--ec-accent);
    }

/* —— Body —— */
.ec-auth-body {
    padding: 24px 36px 28px;
    display: flex;
    flex-direction: column;
    gap: 18px;
}

@media (max-width: 540px) {
    .ec-auth-header {
        padding: 28px 22px 6px;
    }

    .ec-auth-body {
        padding: 20px 22px 24px;
    }
}

/* —— Field —— */
.ec-field {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.ec-field-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.ec-field-link {
    background: none;
    border: 0;
    padding: 0;
    cursor: pointer;
    font-family: inherit;
    font-size: 12px;
    font-weight: 500;
    color: var(--ec-accent);
    transition: color var(--ec-dur-fast) var(--ec-ease);
}

    .ec-field-link:hover {
        color: var(--ec-accent-h);
        text-decoration: underline;
    }

/* —— Input с inline-action —— */
.ec-input-wrap {
    position: relative;
}

.ec-input--mono {
    font-family: var(--ec-font-mono);
    letter-spacing: .04em;
}

.ec-input--with-action {
    padding-right: 44px;
}

.ec-input-action {
    position: absolute;
    right: 6px;
    top: 50%;
    transform: translateY(-50%);
    width: 32px;
    height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: 0;
    color: var(--ec-faint);
    cursor: pointer;
    border-radius: var(--ec-r-sm);
    transition: background var(--ec-dur-fast) var(--ec-ease), color var(--ec-dur-fast) var(--ec-ease);
}

    .ec-input-action:hover {
        background: var(--ec-grey-max);
        color: var(--ec-text);
    }

/* —— Custom checkbox —— */
.ec-checkbox {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    user-select: none;
    font-size: 13px;
    color: var(--ec-sub);
    position: relative;
}

    .ec-checkbox input {
        position: absolute;
        opacity: 0;
        pointer-events: none;
    }

.ec-checkbox-box {
    flex-shrink: 0;
    width: 18px;
    height: 18px;
    background: var(--ec-surface);
    border: 1.5px solid var(--ec-border);
    border-radius: 5px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: transparent;
    transition: background var(--ec-dur-fast) var(--ec-ease), border-color var(--ec-dur-fast) var(--ec-ease), color var(--ec-dur-fast) var(--ec-ease);
}

.ec-checkbox input:checked ~ .ec-checkbox-box {
    background: var(--ec-accent);
    border-color: var(--ec-accent);
    color: #fff;
}

.ec-checkbox input:focus-visible ~ .ec-checkbox-box {
    outline: 2px solid var(--ec-accent);
    outline-offset: 2px;
}

.ec-checkbox-label {
    line-height: 1.4;
}

/* —— Кнопка на всю ширину —— */
.ec-btn-block {
    width: 100%;
    justify-content: center;
}

/* —— Alert —— */
.ec-auth-alert {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 14px;
    border-radius: var(--ec-r-md);
    font-size: 13px;
    line-height: 1.5;
}

.ec-auth-alert--danger {
    background: var(--ec-danger-bg);
    color: var(--ec-danger-text);
    border: 1px solid rgba(255, 59, 48, .25);
}

.ec-auth-alert--warning {
    background: var(--ec-warning-bg);
    color: var(--ec-warning-text);
    border: 1px solid rgba(255, 149, 0, .25);
}

.ec-auth-alert--info {
    background: var(--ec-accent-soft);
    color: var(--ec-accent-deep);
    border: 1px solid rgba(0, 113, 227, .25);
}

.ec-auth-alert-icon {
    flex-shrink: 0;
    line-height: 1;
    margin-top: 1px;
}

.ec-auth-alert p {
    margin: 0;
}

/* —— Divider —— */
.ec-auth-divider {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 11px;
    color: var(--ec-muted);
    letter-spacing: .06em;
    text-transform: uppercase;
}

    .ec-auth-divider::before,
    .ec-auth-divider::after {
        content: '';
        flex: 1;
        height: 1px;
        background: var(--ec-border-soft);
    }

/* —— Хвост/ссылки —— */
.ec-auth-footer-text {
    text-align: center;
    font-size: 14px;
    color: var(--ec-sub);
    margin: 0;
}

.ec-auth-link {
    color: var(--ec-accent);
    font-weight: 600;
    text-decoration: none;
    transition: color var(--ec-dur-fast) var(--ec-ease);
}

    .ec-auth-link:hover {
        color: var(--ec-accent-h);
        text-decoration: underline;
    }

/* —— Compliance plate —— */
.ec-auth-compliance {
    display: flex;
    gap: 18px;
    flex-wrap: wrap;
    justify-content: center;
    padding: 16px 36px 22px;
    border-top: 1px solid var(--ec-border-soft);
    background: var(--ec-bg-soft);
}

@media (max-width: 540px) {
    .ec-auth-compliance {
        padding: 14px 22px 18px;
        gap: 12px;
    }
}

.ec-auth-compliance-item {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 11px;
    font-weight: 500;
    color: var(--ec-muted);
}

/* —— Возврат на главную —— */
.ec-auth-back {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 20px;
    font-size: 13px;
    color: var(--ec-sub);
    text-decoration: none;
    transition: color var(--ec-dur-fast) var(--ec-ease);
}

    .ec-auth-back:hover {
        color: var(--ec-text);
    }

/* —— Modal —— */
.ec-modal-overlay {
    position: fixed;
    inset: 0;
    z-index: var(--ec-z-modal);
    background: rgba(0, 0, 0, .42);
    backdrop-filter: blur(2px);
    display: flex;
    align-items: flex-start; 
    justify-content: center;
    padding: 24px 16px env(safe-area-inset-bottom, 16px); 
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    animation: ec-fade-in var(--ec-dur) var(--ec-ease-out) both;
}

/* Центрируем карточку вертикально только если viewport достаточно высокий */
@media (min-height: 600px) {
    .ec-modal-overlay {
        align-items: center;
    }
}

.ec-modal-card {
    width: 100%;
    max-width: 420px;
    max-height: calc(100dvh - 48px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 28px 28px 24px;
    text-align: center;
}

.ec-modal-icon {
    width: 56px;
    height: 56px;
    margin: 0 auto 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--ec-accent-soft);
    color: var(--ec-accent-deep);
    border-radius: var(--ec-r-lg);
}

/* —— Password strength meter —— */
.ec-strength {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 4px;
}

.ec-strength-bars {
    display: flex;
    gap: 4px;
}

.ec-strength-bar {
    flex: 1;
    height: 3px;
    background: var(--ec-border-soft);
    border-radius: 2px;
    transition: background var(--ec-dur) var(--ec-ease);
}

    .ec-strength-bar.is-weak {
        background: var(--ec-danger);
    }

    .ec-strength-bar.is-medium {
        background: var(--ec-warning);
    }

    .ec-strength-bar.is-good {
        background: #f5c518;
    }

    .ec-strength-bar.is-strong {
        background: var(--ec-success);
    }

.ec-strength-label {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 11px;
    font-weight: 500;
    margin: 0;
}

    .ec-strength-label.is-weak {
        color: var(--ec-danger-text);
    }

    .ec-strength-label.is-medium {
        color: var(--ec-warning-text);
    }

    .ec-strength-label.is-good {
        color: #92400e;
    }

    .ec-strength-label.is-strong {
        color: var(--ec-success-text);
    }

/* —— Helper-строка под полем —— */
.ec-helper {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 12px;
    color: var(--ec-muted);
    margin: 4px 0 0;
}

.ec-helper--danger {
    color: var(--ec-danger-text);
}

.ec-helper--success {
    color: var(--ec-success-text);
}

.ec-helper--warning {
    color: var(--ec-warning-text);
}

/* —— Invalid input —— */
.ec-input--invalid {
    border-color: var(--ec-danger);
    box-shadow: 0 0 0 3px rgba(255, 59, 48, .12);
}

/* —— Validation list —— */
.ec-validation-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

    .ec-validation-list li {
        font-size: 12px;
        padding-left: 12px;
        position: relative;
    }

        .ec-validation-list li::before {
            content: '';
            position: absolute;
            left: 2px;
            top: 7px;
            width: 4px;
            height: 4px;
            border-radius: 50%;
            background: currentColor;
            opacity: .6;
        }

/* —— Юридическая нотифика —— */
.ec-auth-legal {
    font-size: 11.5px;
    color: var(--ec-muted);
    line-height: 1.6;
    text-align: center;
    margin: 0;
}

    .ec-auth-legal strong {
        color: var(--ec-text);
        font-weight: 600;
    }

/* —— Setup-page (онбординг) —— */
.ec-setup-page {
    min-height: calc(100vh - 56px);
    background: var(--ec-bg);
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 40px 16px 80px;
    overflow: hidden;
}

.ec-setup-shell {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 720px;
}

.ec-setup-card {
    padding: 0;
    overflow: hidden;
}

.ec-setup-header {
    padding: 28px 36px 22px;
    background: var(--ec-bg-soft);
    border-bottom: 1px solid var(--ec-border-soft);
}

@media (max-width: 540px) {
    .ec-setup-header {
        padding: 22px 22px 18px;
    }
}

.ec-setup-header-row {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 22px;
}

.ec-setup-header-text .ec-title-3 {
    margin-top: 2px;
}

.ec-stepper {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0;
}

.ec-stepper-step {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.ec-stepper-dot {
    width: 26px;
    height: 26px;
    flex-shrink: 0;
    background: var(--ec-surface);
    border: 1.5px solid var(--ec-border);
    color: var(--ec-muted);
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
    transition: background var(--ec-dur) var(--ec-ease), border-color var(--ec-dur) var(--ec-ease), color var(--ec-dur) var(--ec-ease);
}

.ec-stepper-step.is-current .ec-stepper-dot {
    background: var(--ec-accent);
    border-color: var(--ec-accent);
    color: #fff;
    box-shadow: 0 0 0 4px rgba(0, 113, 227, .14);
}

.ec-stepper-step.is-done .ec-stepper-dot {
    background: var(--ec-success);
    border-color: var(--ec-success);
    color: #fff;
}

.ec-stepper-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--ec-muted);
    transition: color var(--ec-dur) var(--ec-ease);
}

.ec-stepper-step.is-current .ec-stepper-label {
    color: var(--ec-text);
}

.ec-stepper-step.is-done .ec-stepper-label {
    color: var(--ec-text-soft);
}

.ec-stepper-line {
    flex: 1;
    height: 1.5px;
    background: var(--ec-border);
    margin: 0 14px;
    min-width: 18px;
}

@media (max-width: 600px) {
    .ec-stepper-label {
        display: none;
    }

    .ec-stepper-line {
        margin: 0 8px;
    }
}

.ec-setup-progress {
    height: 3px;
    background: var(--ec-border-soft);
    border-radius: 2px;
    margin-top: 18px;
    overflow: hidden;
}

.ec-setup-progress-bar {
    height: 100%;
    background: var(--ec-accent);
    border-radius: 2px;
    transition: width var(--ec-dur-slow) var(--ec-ease);
}

.ec-setup-body {
    padding: 28px 36px;
}

@media (max-width: 540px) {
    .ec-setup-body {
        padding: 22px;
    }
}

.ec-setup-name-grid {
    grid-template-columns: 1fr 1fr 1fr;
    gap: 12px;
}

@media (max-width: 600px) {
    .ec-setup-name-grid {
        grid-template-columns: 1fr;
    }
}

.ec-label-hint {
    font-weight: 400;
    font-size: 11px;
    color: var(--ec-muted);
    text-transform: none;
    letter-spacing: 0;
    margin-left: 4px;
}

.ec-input-prefix {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 14px;
    font-weight: 700;
    color: var(--ec-sub);
    pointer-events: none;
}

.ec-input--with-prefix {
    padding-left: 30px;
}

.ec-input--numeric {
    max-width: 140px;
}

.ec-input--state-ok {
    border-color: var(--ec-success);
    box-shadow: 0 0 0 3px rgba(52, 199, 89, .12);
}

.ec-input--state-taken {
    border-color: var(--ec-danger);
    box-shadow: 0 0 0 3px rgba(255, 59, 48, .12);
}

.ec-input-action--ok {
    color: var(--ec-success);
}

.ec-input-action--err {
    color: var(--ec-danger);
}

.ec-input-action--checking {
    color: var(--ec-muted);
    animation: ec-pulse-soft 1.4s ease-in-out infinite;
}

.ec-segmented {
    display: inline-flex;
    background: var(--ec-bg-soft);
    border: 1px solid var(--ec-border);
    border-radius: var(--ec-r-md);
    padding: 4px;
    gap: 2px;
    flex-wrap: wrap;
    position: relative;
}

    .ec-segmented input[type="radio"] {
        position: absolute;
        opacity: 0;
        pointer-events: none;
    }

.ec-segmented-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    font-size: 13px;
    font-weight: 500;
    color: var(--ec-sub);
    border-radius: var(--ec-r-sm);
    cursor: pointer;
    user-select: none;
    transition: background var(--ec-dur-fast) var(--ec-ease), color var(--ec-dur-fast) var(--ec-ease);
}

.ec-segmented input[type="radio"]:checked + .ec-segmented-item {
    background: var(--ec-surface);
    color: var(--ec-text);
    box-shadow: var(--ec-shadow-sm);
}

.ec-segmented-item:hover {
    color: var(--ec-text);
}

.ec-spec-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

@media (max-width: 760px) {
    .ec-spec-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 420px) {
    .ec-spec-grid {
        grid-template-columns: 1fr;
    }
}

.ec-spec-chip {
    position: relative;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    background: var(--ec-surface);
    border: 1.5px solid var(--ec-border);
    border-radius: var(--ec-r-md);
    cursor: pointer;
    user-select: none;
    transition: background var(--ec-dur-fast) var(--ec-ease), border-color var(--ec-dur-fast) var(--ec-ease), transform var(--ec-dur-fast) var(--ec-ease);
}

    .ec-spec-chip:hover {
        border-color: var(--ec-border-strong);
        background: var(--ec-bg-soft);
        transform: translateY(-1px);
    }

    .ec-spec-chip input[type="radio"] {
        position: absolute;
        opacity: 0;
        pointer-events: none;
    }

    .ec-spec-chip.is-selected {
        background: var(--ec-accent-soft);
        border-color: var(--ec-accent);
        color: var(--ec-accent-deep);
    }

.ec-spec-chip-icon {
    flex-shrink: 0;
    width: 30px;
    height: 30px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--ec-bg-soft);
    border-radius: var(--ec-r-sm);
    color: var(--ec-text-soft);
}

.ec-spec-chip.is-selected .ec-spec-chip-icon {
    background: var(--ec-surface);
    color: var(--ec-accent-deep);
}

.ec-spec-chip-label {
    font-size: 13px;
    font-weight: 500;
    color: inherit;
}

.ec-autocomplete-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    width: 100%;
}

.ec-autocomplete-name {
    font-size: 14px;
    font-weight: 500;
    color: var(--ec-text);
}

.ec-autocomplete-meta {
    font-size: 11px;
    color: var(--ec-muted);
}

.ec-file-drop {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 36px 24px;
    background: var(--ec-bg-soft);
    border: 2px dashed var(--ec-border);
    border-radius: var(--ec-r-lg);
    cursor: pointer;
    text-align: center;
    transition: background var(--ec-dur) var(--ec-ease), border-color var(--ec-dur) var(--ec-ease);
}

    .ec-file-drop:hover {
        background: var(--ec-grey-max);
        border-color: var(--ec-accent);
    }

.ec-file-drop-icon {
    width: 56px;
    height: 56px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--ec-surface);
    border: 1px solid var(--ec-border);
    border-radius: var(--ec-r-md);
    color: var(--ec-text-soft);
    margin-bottom: 4px;
}

.ec-file-drop-icon--ok {
    background: var(--ec-success-bg);
    color: var(--ec-success-text);
    border-color: transparent;
}

.ec-file-drop-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--ec-text);
    margin: 0;
}

.ec-file-drop-hint {
    font-size: 12px;
    color: var(--ec-muted);
    margin: 0;
}

.ec-setup-actions {
    margin-top: 8px;
}

.ec-setup-actions--double {
    display: grid;
    grid-template-columns: 1fr 1.5fr;
    gap: 10px;
}

@media (max-width: 480px) {
    .ec-setup-actions--double {
        grid-template-columns: 1fr;
    }
}

.ec-ac-dropdown--down {
    top: calc(100% + 4px);
    bottom: auto;
}

.ec-ac-dropdown--up {
    bottom: calc(100% + 4px);
    top: auto;
}
