* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Кастомный скроллбар */
::-webkit-scrollbar {
    width: 12px;
    height: 12px;
}

::-webkit-scrollbar-track {
    background: rgba(15, 23, 42, 0.3);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    border-radius: 10px;
    border: 2px solid rgba(15, 23, 42, 0.3);
}

::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, var(--primary-light), var(--primary));
    box-shadow: 0 0 10px rgba(99, 102, 241, 0.5);
}

/* Firefox */
* {
    scrollbar-width: thin;
    scrollbar-color: var(--primary) rgba(15, 23, 42, 0.3);
}

:root {
    --primary: #6366F1;
    --primary-dark: #4F46E5;
    --primary-light: #818CF8;
    --secondary: #64748B;
    --success: #10B981;
    --danger: #EF4444;
    --warning: #F59E0B;
    --bg: #1E293B;
    --bg-gradient: linear-gradient(135deg, #1E293B 0%, #334155 50%, #475569 100%);
    --card-bg: rgba(255, 255, 255, 0.08);
    --card-bg-hover: rgba(255, 255, 255, 0.12);
    --text: #F8FAFC;
    --text-light: #CBD5E1;
    --border: rgba(148, 163, 184, 0.2);
    --shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.15);
    --shadow-xl: 0 20px 25px rgba(0, 0, 0, 0.2);
    --glow: 0 0 15px rgba(99, 102, 241, 0.3);
    --glow-success: 0 0 15px rgba(16, 185, 129, 0.3);
    --glow-danger: 0 0 15px rgba(239, 68, 68, 0.3);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--bg);
    background-image: var(--bg-gradient);
    background-attachment: fixed;
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
    position: relative;
    overflow-x: hidden;
}

/* Статичный фон (без анимации для производительности) */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: 
        radial-gradient(circle at 20% 50%, rgba(99, 102, 241, 0.08) 0%, transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(16, 185, 129, 0.08) 0%, transparent 50%),
        radial-gradient(circle at 40% 20%, rgba(139, 92, 246, 0.08) 0%, transparent 50%);
    pointer-events: none;
    z-index: 0;
}

.container {
    max-width: 95%;
    margin: 0 auto;
    padding: 2rem;
    position: relative;
    z-index: 1;
}

/* Навигация (хлебные крошки) */
.breadcrumb {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 2rem;
    padding: 1rem 1.5rem;
    background: var(--card-bg);
    border-radius: 16px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    animation: slideInDown 0.5s ease;
}

.breadcrumb-item {
    color: var(--text-light);
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    padding: 0.25rem 0.5rem;
    border-radius: 8px;
    position: relative;
}

.breadcrumb-item::before {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    width: 0;
    height: 2px;
    background: linear-gradient(90deg, var(--primary), var(--primary-light));
    transform: translateX(-50%);
    transition: width 0.3s ease;
}

.breadcrumb-item:hover {
    color: var(--primary-light);
    transform: translateY(-2px);
}

.breadcrumb-item:hover::before {
    width: 80%;
}

.breadcrumb-item.active {
    color: var(--primary-light);
    font-weight: 600;
    background: rgba(99, 102, 241, 0.1);
}

.breadcrumb-item:not(:last-child)::after {
    content: '›';
    margin-left: 0.5rem;
    color: var(--text-light);
}

@keyframes slideInDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Заголовок */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    animation: slideInDown 0.6s ease 0.1s both;
}

.header h1 {
    font-size: 2.5rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--primary-light), var(--primary), #8B5CF6);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    position: relative;
    filter: drop-shadow(0 0 10px rgba(99, 102, 241, 0.3));
}

/* Кнопки */
.btn-add {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.875rem 1.75rem;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: var(--shadow), var(--glow);
    position: relative;
    overflow: hidden;
}

.btn-add::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.btn-add:hover::before {
    width: 300px;
    height: 300px;
}

.btn-add:hover {
    transform: translateY(-3px) scale(1.02);
    box-shadow: var(--shadow-xl), 0 0 30px rgba(99, 102, 241, 0.6);
}

.btn-add:active {
    transform: translateY(-1px) scale(0.98);
}

.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 12px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.btn::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.15);
    transform: translate(-50%, -50%);
    transition: width 0.5s, height 0.5s;
}

.btn:hover::after {
    width: 300px;
    height: 300px;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    box-shadow: var(--shadow), var(--glow);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg), 0 0 25px rgba(99, 102, 241, 0.5);
}

.btn-secondary {
    background: var(--card-bg);
    color: var(--text);
    border: 1px solid var(--border);
    backdrop-filter: blur(10px);
}

.btn-secondary:hover {
    background: var(--card-bg-hover);
    border-color: var(--primary-light);
    transform: translateY(-2px);
}

.btn-success {
    background: linear-gradient(135deg, var(--success), #059669);
    color: white;
    box-shadow: var(--shadow), var(--glow-success);
}

.btn-success:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg), 0 0 25px rgba(16, 185, 129, 0.5);
}

.btn-danger {
    background: linear-gradient(135deg, var(--danger), #DC2626);
    color: white;
    box-shadow: var(--shadow), var(--glow-danger);
}

.btn-danger:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg), 0 0 25px rgba(239, 68, 68, 0.5);
}

/* Сетка карточек */
.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 2rem;
}

/* Карточка */
.card {
    position: relative;
    background: var(--card-bg);
    backdrop-filter: blur(10px);
    border-radius: 16px;
    padding: 1.75rem;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    animation: fadeInUp 0.6s ease both;
    overflow: hidden;
}

.card::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(99, 102, 241, 0.1), transparent);
    transition: left 0.6s;
}

.card:hover::before {
    left: 100%;
}

.card:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: var(--shadow-xl), 0 0 40px rgba(99, 102, 241, 0.3);
    border-color: var(--primary-light);
}

/* Эффект появления карточек с задержкой */
.card:nth-child(1) { animation-delay: 0.1s; }
.card:nth-child(2) { animation-delay: 0.2s; }
.card:nth-child(3) { animation-delay: 0.3s; }
.card:nth-child(4) { animation-delay: 0.4s; }
.card:nth-child(5) { animation-delay: 0.5s; }
.card:nth-child(6) { animation-delay: 0.6s; }

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

.card-title {
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 0.75rem;
    background: linear-gradient(135deg, var(--text), var(--primary-light));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.card-description {
    color: var(--text-light);
    font-size: 0.95rem;
    line-height: 1.6;
}

/* Контейнер для кнопок действий на карточке */
.card-actions {
    position: absolute;
    top: 1rem;
    right: 1rem;
    display: flex;
    gap: 0.5rem;
    opacity: 0;
    transform: translateY(-5px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.card:hover .card-actions {
    opacity: 1;
    transform: translateY(0);
}

/* Кнопка редактирования */
.card-edit {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #3B82F6, #2563EB);
    color: white;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: var(--shadow);
}

.card-edit:hover {
    transform: scale(1.1) translateY(-2px);
    box-shadow: var(--shadow-lg), 0 0 20px rgba(59, 130, 246, 0.4);
}

.card-edit:active {
    transform: scale(0.95);
}

/* Кнопка удаления */
.card-delete {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--danger), #DC2626);
    color: white;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: var(--shadow);
}

.card-delete:hover {
    transform: scale(1.1) translateY(-2px);
    box-shadow: var(--shadow-lg), var(--glow-danger);
}

.card-delete:active {
    transform: scale(0.95);
}

/* Страница магазина */
.store-page {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.store-settings {
    background: var(--card-bg);
    border-radius: 16px;
    padding: 2rem;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    animation: fadeInUp 0.5s ease;
}

.store-settings h2 {
    font-size: 1.75rem;
    margin-bottom: 1.5rem;
    background: linear-gradient(135deg, var(--text), var(--primary-light));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-weight: 700;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 0.75rem;
    font-size: 0.95rem;
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 0.875rem 1rem;
    background: rgba(71, 85, 105, 0.3);
    border: 2px solid var(--border);
    border-radius: 12px;
    font-size: 1rem;
    color: var(--text);
    transition: all 0.2s ease;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary-light);
    background: rgba(71, 85, 105, 0.4);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

.form-text {
    display: block;
    margin-top: 0.5rem;
    font-size: 0.85rem;
    color: var(--text-light);
}

.double-input {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

/* Платформы (Telegram, VK, Avito, WhatsApp) */
.platforms {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 2rem;
}

.platform-section {
    background: var(--card-bg);
    border-radius: 16px;
    padding: 2rem;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    transition: all 0.3s ease;
    animation: fadeInUp 0.5s ease both;
    position: relative;
    overflow: hidden;
}

.platform-section::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: linear-gradient(90deg, var(--primary), var(--primary-light), #8B5CF6);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.5s ease;
}

.platform-section:hover::after {
    transform: scaleX(1);
}

.platform-section:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg), 0 0 30px rgba(99, 102, 241, 0.2);
    border-color: var(--primary-light);
}

.platform-section:nth-child(1) { animation-delay: 0.1s; }
.platform-section:nth-child(2) { animation-delay: 0.2s; }
.platform-section:nth-child(3) { animation-delay: 0.3s; }
.platform-section:nth-child(4) { animation-delay: 0.4s; }

.platform-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.platform-title {
    font-size: 1.35rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--text), var(--primary-light));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.platform-add {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: var(--shadow), var(--glow);
    position: relative;
}

.platform-add::before {
    content: '';
    position: absolute;
    inset: -2px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-light), var(--primary));
    opacity: 0;
    transition: opacity 0.3s;
    z-index: -1;
}

.platform-add:hover::before {
    opacity: 1;
}

.platform-add:hover {
    transform: scale(1.15) rotate(90deg);
    box-shadow: var(--shadow-lg), 0 0 25px rgba(99, 102, 241, 0.6);
}

.platform-add:active {
    transform: scale(1.05) rotate(90deg);
}

/* Аккаунт */
.account-card {
    background: rgba(71, 85, 105, 0.3);
    border-radius: 12px;
    padding: 1.25rem;
    margin-bottom: 1rem;
    position: relative;
    border: 1px solid var(--border);
    transition: all 0.2s ease;
    animation: fadeInUp 0.4s ease both;
}

.account-card:hover {
    background: rgba(71, 85, 105, 0.4);
    border-color: var(--primary-light);
    transform: translateX(3px);
    box-shadow: var(--shadow), -2px 0 0 var(--primary-light);
}

.account-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}

.account-name {
    font-weight: 700;
    font-size: 1.05rem;
    color: var(--text);
}

.account-status {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.35rem 0.9rem;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
}

.account-status::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
}

.account-status.active {
    background: rgba(16, 185, 129, 0.15);
    color: var(--success);
    box-shadow: 0 0 15px rgba(16, 185, 129, 0.3);
}

.account-status.inactive {
    background: rgba(239, 68, 68, 0.15);
    color: var(--danger);
    box-shadow: 0 0 15px rgba(239, 68, 68, 0.3);
}

.account-status.authorized {
    background: rgba(99, 102, 241, 0.15);
    color: var(--primary-light);
    box-shadow: 0 0 15px rgba(99, 102, 241, 0.3);
}

.account-phone {
    font-size: 0.9rem;
    color: var(--text-light);
    margin-bottom: 0.75rem;
}

.account-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.account-actions button {
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-start {
    background: var(--success);
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-start:hover {
    background: #059669;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.4);
}

.btn-start:active {
    transform: translateY(0);
    box-shadow: 0 2px 6px rgba(16, 185, 129, 0.3);
}

.btn-stop {
    background: var(--warning);
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-stop:hover {
    background: #D97706;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.4);
}

.btn-stop:active {
    transform: translateY(0);
    box-shadow: 0 2px 6px rgba(245, 158, 11, 0.3);
}

.btn-edit {
    background: var(--secondary);
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-edit:hover {
    background: #475569;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(71, 85, 105, 0.3);
}

.btn-edit:active {
    transform: translateY(0);
    box-shadow: 0 2px 6px rgba(71, 85, 105, 0.2);
}

.btn-auth {
    background: var(--primary);
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-auth:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
}

.btn-auth:active {
    transform: translateY(0);
    box-shadow: 0 2px 6px rgba(99, 102, 241, 0.3);
}

.btn-delete-account {
    background: var(--danger);
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
}

.btn-delete-account:hover {
    background: #DC2626;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.4);
}

.btn-delete-account:active {
    transform: translateY(0);
    box-shadow: 0 2px 6px rgba(239, 68, 68, 0.3);
}

.btn-scenario-settings {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    padding: 0.4rem 0.5rem;
    cursor: pointer;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

.btn-scenario-settings:hover {
    background: linear-gradient(135deg, #764ba2 0%, #667eea 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.5);
}

.btn-scenario-settings:active {
    transform: translateY(0);
    box-shadow: 0 2px 6px rgba(102, 126, 234, 0.4);
}

/* Кнопка настройки таймера менеджера */
.btn-manager-timeout {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    border: none;
    padding: 0.4rem 0.5rem;
    cursor: pointer;
    color: white;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.3);
    font-size: 0.85rem;
}

.btn-manager-timeout:hover {
    background: linear-gradient(135deg, #059669 0%, #047857 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.5);
}

.btn-manager-timeout:active {
    transform: translateY(0);
    box-shadow: 0 2px 6px rgba(16, 185, 129, 0.4);
}

/* Кнопка настройки дожимов на платформе */
.platform-followup {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    border: none;
    padding: 0.5rem 0.75rem;
    cursor: pointer;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(245, 158, 11, 0.3);
    min-width: 40px;
}

.platform-followup:hover {
    background: linear-gradient(135deg, #d97706 0%, #f59e0b 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.5);
}

.platform-followup:active {
    transform: translateY(0);
    box-shadow: 0 2px 6px rgba(245, 158, 11, 0.4);
}

/* Убираем стрелки у input type="number" */
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

input[type="number"] {
    -moz-appearance: textfield;
}

/* Список дожимов */
.followups-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.followup-item {
    background: var(--card-bg);
    border: 2px solid rgba(245, 158, 11, 0.2);
    border-radius: 12px;
    padding: 1.5rem;
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    position: relative;
    transition: all 0.3s ease;
}

.followup-item:hover {
    border-color: rgba(245, 158, 11, 0.4);
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.1);
}

.followup-number {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.1rem;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(245, 158, 11, 0.3);
}

.followup-fields {
    flex: 1;
}

.btn-remove-followup {
    position: absolute;
    top: 1rem;
    right: 1rem;
    width: 32px;
    height: 32px;
    background: rgba(239, 68, 68, 0.1);
    border: 2px solid rgba(239, 68, 68, 0.2);
    border-radius: 8px;
    color: var(--danger);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.btn-remove-followup:hover {
    background: rgba(239, 68, 68, 0.2);
    border-color: rgba(239, 68, 68, 0.4);
    transform: scale(1.1);
}

.btn-remove-followup:active {
    transform: scale(0.95);
}

/* Модальное окно */
.modal {
    display: none !important;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 9999;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.2s ease;
}

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

.modal.active {
    display: flex !important;
}

.modal-content {
    background: #2D3748;
    border-radius: 20px;
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-xl);
    border: 1px solid var(--border);
    animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-large .modal-content {
    max-width: 700px;
}

.modal-xl .modal-content {
    max-width: 1200px;
    width: 95%;
    overflow: hidden;
}

.modal-xl .modal-body {
    max-height: calc(90vh - 200px);
    overflow-y: auto;
    overflow-x: hidden;
}

.modal-small .modal-content {
    max-width: 450px;
}

/* Окно подтверждения */
#confirmModal .modal-body {
    padding: 2rem;
    text-align: center;
}

#confirmModal .modal-body p {
    margin: 0;
}

#confirmModal .modal-footer {
    display: flex;
    gap: 1rem;
    justify-content: center;
}

#confirmModal .btn {
    min-width: 120px;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.75rem 2rem;
    border-bottom: 1px solid var(--border);
    background: rgba(99, 102, 241, 0.05);
}

.modal-header h2 {
    font-size: 1.75rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--text), var(--primary-light));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.modal-close {
    background: rgba(239, 68, 68, 0.1);
    border: none;
    font-size: 1.5rem;
    color: var(--danger);
    cursor: pointer;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.modal-close:hover {
    background: var(--danger);
    color: white;
    transform: rotate(90deg) scale(1.1);
    box-shadow: var(--shadow), var(--glow-danger);
}

.modal-body {
    padding: 2rem;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    padding: 1.5rem 2rem;
    border-top: 1px solid var(--border);
    background: rgba(99, 102, 241, 0.03);
}

/* Авторизация */
.auth-step {
    padding: 1rem;
}

.auth-step p {
    margin-bottom: 1rem;
    color: var(--text-light);
}

/* Ввод кода с квадратиками */
.code-input-container {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin: 1.5rem 0;
}

.code-digit {
    width: 55px;
    height: 65px;
    text-align: center;
    font-size: 1.75rem;
    font-weight: 700;
    border: 2px solid var(--border);
    border-radius: 12px;
    transition: all 0.2s ease;
    background: rgba(71, 85, 105, 0.3);
    color: var(--text);
}

.code-digit:focus {
    outline: none;
    border-color: var(--primary-light);
    background: rgba(71, 85, 105, 0.4);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

.code-digit:not(:placeholder-shown) {
    border-color: var(--primary);
    background: rgba(99, 102, 241, 0.15);
}

/* Стили для редактора сценариев */

#scenariosList {
    width: 100%;
    box-sizing: border-box;
    overflow-x: hidden;
}

/* Сетка карточек сценариев */
.scenarios-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1rem;
    padding: 0.5rem 0;
    width: 100%;
    box-sizing: border-box;
}

/* Карточка-превью сценария (для списка) */
.scenario-card-preview {
    background: var(--surface);
    border: 2px solid var(--border);
    border-radius: 12px;
    padding: 1.25rem;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.scenario-card-preview:hover {
    border-color: var(--primary);
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.15);
    transform: translateY(-2px);
}

.scenario-card-icon {
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    flex-shrink: 0;
}

.scenario-card-content {
    flex: 1;
    min-width: 0;
}

.scenario-card-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text);
    margin: 0 0 0.5rem 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.scenario-card-description {
    font-size: 0.9rem;
    color: var(--text-light);
    margin: 0 0 0.75rem 0;
    line-height: 1.4;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.scenario-card-meta {
    display: flex;
    gap: 1rem;
    font-size: 0.85rem;
    color: var(--text-light);
}

.scenario-card-meta span {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.scenario-card-arrow {
    color: var(--text-light);
    flex-shrink: 0;
    transition: transform 0.3s;
}

.scenario-card-preview:hover .scenario-card-arrow {
    transform: translateX(4px);
    color: var(--primary);
}

/* Карточка редактора сценария */
.scenario-card {
    background: var(--bg);
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    border: 2px solid var(--border);
    width: 100%;
    box-sizing: border-box;
    overflow: hidden;
}

.scenario-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.scenario-trigger-input {
    flex: 1;
    margin-right: 1rem;
}

.btn-delete-scenario {
    background: linear-gradient(135deg, #EF4444, #DC2626);
    color: white;
    border: none;
    padding: 0.6rem 1.2rem;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
    font-weight: 600;
    font-size: 0.9rem;
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.3);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-delete-scenario:hover {
    background: linear-gradient(135deg, #DC2626, #B91C1C);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.4);
    transform: translateY(-1px);
}

.btn-delete-scenario:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(239, 68, 68, 0.3);
}

.scenario-images {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1rem;
}

.scenario-image-wrapper {
    position: relative;
    width: 120px;
    height: 120px;
}

.scenario-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 8px;
    cursor: pointer;
}

.btn-remove-image {
    position: absolute;
    top: -8px;
    right: -8px;
    background: linear-gradient(135deg, #EF4444, #DC2626);
    color: white;
    border: none;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    font-weight: bold;
    line-height: 1;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    transition: all 0.2s;
}

.btn-remove-image:hover {
    background: linear-gradient(135deg, #DC2626, #B91C1C);
    transform: scale(1.1);
    box-shadow: 0 3px 12px rgba(0, 0, 0, 0.4);
}

.scenario-image-wrapper:hover .btn-remove-image {
    display: flex;
}

.vk-photo-badge {
    position: absolute;
    bottom: 4px;
    left: 4px;
    background: linear-gradient(135deg, #4680C2, #5181B8);
    color: white;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 600;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.scenario-buttons-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-top: 1rem;
}

.scenario-button-item {
    background: rgba(71, 85, 105, 0.2);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1rem;
    display: flex;
    gap: 1rem;
    align-items: flex-start;
}

.scenario-button-number {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.9rem;
    flex-shrink: 0;
}

.scenario-button-item input,
.scenario-button-item select {
    flex: 1;
}

.custom-select {
    background: rgba(71, 85, 105, 0.3);
    border: 2px solid var(--border);
    border-radius: 10px;
    padding: 0.75rem 2.75rem 0.75rem 1rem;
    font-size: 0.9rem;
    color: var(--text);
    cursor: pointer;
    transition: all 0.2s ease;
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23818CF8' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 0.875rem center;
    background-size: 1.1rem;
    font-weight: 500;
}

.custom-select option {
    background: #2D3748;
    color: #F8FAFC;
    padding: 0.75rem;
    font-weight: 500;
}

.custom-select option:hover,
.custom-select option:checked {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
}

.custom-select:hover {
    background: rgba(71, 85, 105, 0.4);
    border-color: var(--primary-light);
}

.custom-select:focus {
    outline: none;
    background: rgba(71, 85, 105, 0.5);
    border-color: var(--primary-light);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

.btn-remove-button {
    background: linear-gradient(135deg, #EF4444, #DC2626);
    color: white;
    border: none;
    padding: 0.5rem;
    width: 32px;
    height: 32px;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    font-weight: bold;
    line-height: 1;
    box-shadow: 0 2px 6px rgba(239, 68, 68, 0.3);
    transition: all 0.2s;
}

.btn-remove-button:hover {
    background: linear-gradient(135deg, #DC2626, #B91C1C);
    transform: scale(1.05);
    box-shadow: 0 3px 10px rgba(239, 68, 68, 0.4);
}

.btn-remove-button:active {
    transform: scale(0.95);
}

/* Превью кнопок */
.buttons-preview {
    background: rgba(71, 85, 105, 0.2);
    border: 2px dashed var(--border);
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.buttons-preview-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    gap: 1rem;
}

.buttons-preview-label {
    font-size: 0.9rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--text-light), var(--primary-light));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.btn-theme-toggle {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.875rem;
    background: rgba(99, 102, 241, 0.1);
    border: 1px solid var(--primary-light);
    border-radius: 8px;
    color: var(--primary-light);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-theme-toggle:hover {
    background: rgba(99, 102, 241, 0.2);
    transform: translateY(-1px);
}

.btn-theme-toggle svg {
    flex-shrink: 0;
}

.buttons-preview-hint {
    margin-top: 1rem;
    padding: 0.75rem 1rem;
    background: rgba(99, 102, 241, 0.15);
    border-left: 4px solid var(--primary-light);
    border-radius: 8px;
    font-size: 0.85rem;
    color: var(--text-light);
    line-height: 1.6;
}

.buttons-preview-grid {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.02);
    border-radius: 12px;
    border: 1px solid var(--border);
    transition: background 0.3s ease;
}

.buttons-preview-grid[data-theme="dark"] {
    background: rgba(0, 0, 0, 0.15);
}

.buttons-preview-row {
    display: flex;
    gap: 0.75rem;
}

.preview-button {
    flex: 1;
    padding: 0.875rem 1.25rem;
    border-radius: 10px;
    font-weight: 600;
    font-size: 0.95rem;
    text-align: center;
    color: white;
    border: none;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.2);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.preview-button::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    transform: translate(-50%, -50%);
    transition: width 0.5s, height 0.5s;
}

.preview-button:hover::before {
    width: 300px;
    height: 300px;
}

.preview-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.3);
}

/* ========== Кнопки VK - Светлая тема (по умолчанию) ========== */

/* PRIMARY - Синяя в светлой теме */
.preview-button-vk-primary {
    background: linear-gradient(135deg, #5181B8, #4272A6);
    color: white;
    box-shadow: 0 4px 10px rgba(81, 129, 184, 0.4);
}

.preview-button-vk-primary:hover {
    box-shadow: 0 6px 15px rgba(81, 129, 184, 0.6);
}

/* SECONDARY - Белая в светлой теме */
.preview-button-vk-secondary {
    background: linear-gradient(135deg, #FFFFFF, #F5F5F5);
    color: #2C2D2E;
    border: 1px solid rgba(0, 0, 0, 0.12);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08);
}

.preview-button-vk-secondary:hover {
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.12);
}

/* POSITIVE - Зелёная */
.preview-button-vk-positive {
    background: linear-gradient(135deg, #4BB34B, #3FA83F);
    color: white;
    box-shadow: 0 4px 10px rgba(75, 179, 75, 0.4);
}

.preview-button-vk-positive:hover {
    box-shadow: 0 6px 15px rgba(75, 179, 75, 0.6);
}

/* NEGATIVE - Красная */
.preview-button-vk-negative {
    background: linear-gradient(135deg, #E64646, #D13838);
    color: white;
    box-shadow: 0 4px 10px rgba(230, 70, 70, 0.4);
}

.preview-button-vk-negative:hover {
    box-shadow: 0 6px 15px rgba(230, 70, 70, 0.6);
}

/* ========== Кнопки VK - Темная тема ========== */

/* PRIMARY - Белая в темной теме */
.buttons-preview-grid[data-theme="dark"] .preview-button-vk-primary {
    background: linear-gradient(135deg, #FFFFFF, #F0F0F0);
    color: #2C2D2E;
    box-shadow: 0 4px 10px rgba(255, 255, 255, 0.2);
}

.buttons-preview-grid[data-theme="dark"] .preview-button-vk-primary:hover {
    box-shadow: 0 6px 15px rgba(255, 255, 255, 0.3);
}

/* SECONDARY - Черная в темной теме */
.buttons-preview-grid[data-theme="dark"] .preview-button-vk-secondary {
    background: linear-gradient(135deg, #2C2D2E, #222222);
    color: #E1E3E6;
    border: 1px solid rgba(255, 255, 255, 0.12);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.buttons-preview-grid[data-theme="dark"] .preview-button-vk-secondary:hover {
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.4);
}

/* POSITIVE - Зелёная (одинаково в обеих темах) */
.buttons-preview-grid[data-theme="dark"] .preview-button-vk-positive {
    background: linear-gradient(135deg, #4BB34B, #3FA83F);
    color: white;
    box-shadow: 0 4px 10px rgba(75, 179, 75, 0.4);
}

.buttons-preview-grid[data-theme="dark"] .preview-button-vk-positive:hover {
    box-shadow: 0 6px 15px rgba(75, 179, 75, 0.6);
}

/* NEGATIVE - Красная (одинаково в обеих темах) */
.buttons-preview-grid[data-theme="dark"] .preview-button-vk-negative {
    background: linear-gradient(135deg, #E64646, #D13838);
    color: white;
    box-shadow: 0 4px 10px rgba(230, 70, 70, 0.4);
}

.buttons-preview-grid[data-theme="dark"] .preview-button-vk-negative:hover {
    box-shadow: 0 6px 15px rgba(230, 70, 70, 0.6);
}

/* ========== Старые стили для обратной совместимости ========== */
.preview-button-gray {
    background: linear-gradient(135deg, #F8FAFC, #E2E8F0);
    color: #334155;
    border: 1px solid rgba(148, 163, 184, 0.3);
}

.preview-button-white {
    background: linear-gradient(135deg, #6366F1, #4F46E5);
    box-shadow: 0 4px 10px rgba(99, 102, 241, 0.4);
}

.preview-button-white:hover {
    box-shadow: 0 6px 15px rgba(99, 102, 241, 0.6);
}

.preview-button-green {
    background: linear-gradient(135deg, #10B981, #059669);
    box-shadow: 0 4px 10px rgba(16, 185, 129, 0.4);
}

.preview-button-green:hover {
    box-shadow: 0 6px 15px rgba(16, 185, 129, 0.6);
}

.preview-button-red {
    background: linear-gradient(135deg, #EF4444, #DC2626);
    box-shadow: 0 4px 10px rgba(239, 68, 68, 0.4);
}

.preview-button-red:hover {
    box-shadow: 0 6px 15px rgba(239, 68, 68, 0.6);
}

.buttons-preview-grid[data-theme="dark"] .preview-button-gray {
    background: linear-gradient(135deg, #3E4757, #2D3748);
    color: #CBD5E1;
    border: 1px solid rgba(148, 163, 184, 0.2);
}

.buttons-preview-grid[data-theme="dark"] .preview-button-white {
    background: linear-gradient(135deg, #F8FAFC, #E2E8F0);
    color: #334155;
    box-shadow: 0 4px 10px rgba(248, 250, 252, 0.3);
}

.buttons-preview-grid[data-theme="dark"] .preview-button-white:hover {
    box-shadow: 0 6px 15px rgba(248, 250, 252, 0.4);
}

.buttons-preview-grid[data-theme="dark"] .preview-button-green {
    background: linear-gradient(135deg, #10B981, #059669);
    box-shadow: 0 4px 10px rgba(16, 185, 129, 0.4);
}

.buttons-preview-grid[data-theme="dark"] .preview-button-green:hover {
    box-shadow: 0 6px 15px rgba(16, 185, 129, 0.6);
}

.buttons-preview-grid[data-theme="dark"] .preview-button-red {
    background: linear-gradient(135deg, #EF4444, #DC2626);
    box-shadow: 0 4px 10px rgba(239, 68, 68, 0.4);
}

.buttons-preview-grid[data-theme="dark"] .preview-button-red:hover {
    box-shadow: 0 6px 15px rgba(239, 68, 68, 0.6);
}

/* ========== Предпросмотр Telegram клавиатуры ========== */
.telegram-keyboard-preview {
    background: linear-gradient(135deg, rgba(34, 126, 230, 0.1), rgba(45, 136, 245, 0.05));
    border: 2px dashed rgba(34, 126, 230, 0.3);
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.telegram-keyboard-grid {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 8px;
}

.telegram-keyboard-row {
    display: flex;
    gap: 0.5rem;
}

.telegram-keyboard-button {
    flex: 1;
    padding: 0.75rem 1rem;
    background: linear-gradient(135deg, #F8FAFC, #E2E8F0);
    color: #1E293B;
    border: 1px solid rgba(226, 232, 240, 0.3);
    border-radius: 6px;
    font-weight: 600;
    font-size: 0.9rem;
    text-align: center;
    cursor: default;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    user-select: none;
}

.telegram-keyboard-button:hover {
    background: linear-gradient(135deg, #E2E8F0, #CBD5E1);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

/* Индикатор загрузки для сценариев */
.scenario-loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(30, 41, 59, 0.95);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    border-radius: 16px;
    animation: fadeIn 0.2s ease;
}

.scenario-loading-content {
    text-align: center;
    color: var(--text);
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(99, 102, 241, 0.2);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 1.5rem;
}

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

.progress-bar {
    background: rgba(148, 163, 184, 0.2);
    border-radius: 10px;
    overflow: hidden;
    height: 20px;
    margin: 1rem auto;
    border: 1px solid var(--border);
}

.progress-fill {
    background: linear-gradient(90deg, var(--primary), var(--success));
    height: 100%;
    width: 0%;
    transition: width 0.3s ease;
    border-radius: 10px;
}

/* Модальное окно подтверждения */
#confirmModal {
    z-index: 10000 !important;
}

#confirmModal .modal-content {
    animation: confirmAppear 0.2s ease-out;
}

@keyframes confirmAppear {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Адаптивность */
@media (min-width: 1920px) {
    .container {
        max-width: 98%;
    }
    
    .platforms {
        grid-template-columns: repeat(4, 1fr);
        gap: 2.5rem;
    }
    
    .cards-grid {
        grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
        gap: 2.5rem;
    }
}

@media (max-width: 1200px) {
    .platforms {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .container {
        padding: 1rem;
    }

    .cards-grid {
        grid-template-columns: 1fr;
    }

    .platforms {
        grid-template-columns: 1fr;
    }

    .header h1 {
        font-size: 1.5rem;
    }

    .double-input {
        grid-template-columns: 1fr;
    }
}

/* Система уведомлений (Toast) */
.toast-container {
    position: fixed;
    top: 2rem;
    right: 2rem;
    z-index: 10001; /* Выше всех модальных окон и оверлея */
    display: flex;
    flex-direction: column;
    gap: 1rem;
    max-width: 500px;
    width: auto;
}

/* Затемненный фон для важных уведомлений */
.toast-overlay {
    pointer-events: none; /* Не блокирует клики */
    /* z-index: 1000 устанавливается в JS - ниже модальных окон (9999) */
}

.toast {
    background: #2D3748;
    padding: 1.25rem 1.75rem;
    border-radius: 16px;
    box-shadow: var(--shadow-xl);
    border: 1px solid var(--border);
    display: flex;
    align-items: flex-start;
    gap: 1.25rem;
    min-width: 350px;
    max-width: 500px;
    width: auto;
    animation: toastSlideIn 0.3s ease;
    position: relative;
    overflow: visible;
    pointer-events: all; /* Разрешаем взаимодействие с toast */
}

/* Важные уведомления (error/warning) - более заметные */
.toast.error, .toast.warning {
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5), var(--shadow-xl);
    border-width: 2px;
}

.toast.error {
    border-color: var(--danger);
}

.toast.warning {
    border-color: var(--warning);
}

.toast::before {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 4px;
    animation: progress 3s linear;
    box-shadow: 0 0 10px currentColor;
}

.toast.success::before {
    background: linear-gradient(90deg, var(--success), #059669);
}

.toast.error::before {
    background: linear-gradient(90deg, var(--danger), #DC2626);
}

.toast.info::before {
    background: linear-gradient(90deg, var(--primary), var(--primary-dark));
}

.toast.warning::before {
    background: linear-gradient(90deg, var(--warning), #D97706);
}

.toast-icon {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    min-width: 32px;
    min-height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 1.1rem;
    margin-top: 2px;
}

.toast.success .toast-icon {
    background: rgba(16, 185, 129, 0.2);
    color: var(--success);
    box-shadow: 0 0 15px rgba(16, 185, 129, 0.4);
}

.toast.error .toast-icon {
    background: rgba(239, 68, 68, 0.2);
    color: var(--danger);
    box-shadow: 0 0 15px rgba(239, 68, 68, 0.4);
}

.toast.info .toast-icon {
    background: rgba(99, 102, 241, 0.2);
    color: var(--primary-light);
    box-shadow: 0 0 15px rgba(99, 102, 241, 0.4);
}

.toast.warning .toast-icon {
    background: rgba(245, 158, 11, 0.2);
    color: var(--warning);
    box-shadow: 0 0 15px rgba(245, 158, 11, 0.4);
}

.toast-message {
    flex: 1;
    color: var(--text);
    font-size: 1rem;
    line-height: 1.5;
    font-weight: 500;
    white-space: pre-line;
    word-wrap: break-word;
    overflow-wrap: break-word;
    hyphens: auto;
    word-break: break-all;
    max-width: 100%;
    min-width: 0;
}

.toast-close {
    background: rgba(239, 68, 68, 0.1);
    border: none;
    color: var(--danger);
    cursor: pointer;
    font-size: 1.25rem;
    padding: 0;
    width: 28px;
    height: 28px;
    min-width: 28px;
    min-height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    flex-shrink: 0;
    margin-top: 2px;
}

.toast-close:hover {
    background: var(--danger);
    color: white;
    transform: rotate(90deg) scale(1.1);
    box-shadow: 0 0 15px rgba(239, 68, 68, 0.5);
}

@keyframes toastSlideIn {
    from {
        opacity: 0;
        transform: translateX(150%) scale(0.8);
    }
    to {
        opacity: 1;
        transform: translateX(0) scale(1);
    }
}

/* Анимации */
@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(100%);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes fadeOut {
    to {
        opacity: 0;
        transform: translateX(100%);
    }
}

@keyframes progress {
    from {
        width: 100%;
    }
    to {
        width: 0%;
    }
}

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

.card {
    animation: fadeIn 0.3s ease;
}

/* Адаптивность для уведомлений */
@media (max-width: 768px) {
    .toast-container {
        top: 1rem;
        right: 1rem;
        left: 1rem;
        max-width: calc(100vw - 2rem);
        width: auto;
    }
    
    .toast {
        min-width: 280px;
        max-width: calc(100vw - 2rem);
        width: auto;
    }
}

/* Стили для свитчей (переключателей) */
.switch-label {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    cursor: pointer;
    user-select: none;
}

.switch-container {
    position: relative;
    flex-shrink: 0;
    width: 48px;
    height: 24px;
}

.switch-input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.switch-slider {
    position: relative;
    display: block;
    width: 48px;
    height: 24px;
    background: #cbd5e1;
    border: 2px solid #94a3b8;
    border-radius: 24px;
    transition: all 0.3s;
    cursor: pointer;
}

.switch-slider::before {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    left: 3px;
    top: 2px;
    background: white;
    border-radius: 50%;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
    transition: transform 0.3s;
}

.switch-input:checked + .switch-slider {
    background: var(--success);
    border-color: var(--success);
}

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

.switch-text {
    font-weight: 500;
    color: var(--text);
    flex: 1;
}

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

.tab-button {
    padding: 0.75rem 1.5rem;
    background: transparent;
    border: none;
    border-bottom: 3px solid transparent;
    color: var(--text-light);
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    bottom: -2px;
}

.tab-button:hover {
    color: var(--primary-light);
    background: rgba(99, 102, 241, 0.1);
}

.tab-button.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
    background: rgba(99, 102, 241, 0.15);
}

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

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

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

/* ========== Рассылки ========== */

.platform-broadcast {
    background: linear-gradient(135deg, #10B981, #059669);
    border: none;
    padding: 0.5rem 0.75rem;
    cursor: pointer;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.3);
    min-width: 40px;
}

.platform-broadcast:hover {
    background: linear-gradient(135deg, #059669, #047857);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.5);
}

.platform-broadcast:active {
    transform: translateY(0);
    box-shadow: 0 2px 6px rgba(16, 185, 129, 0.4);
}

.broadcast-card {
    background: var(--card-bg);
    border: 2px solid var(--border);
    border-radius: 12px;
    padding: 1.25rem;
    margin-bottom: 1rem;
    transition: all 0.3s ease;
}

.broadcast-card.new-card {
    animation: fadeInUp 0.4s ease both;
}

.broadcast-card:hover {
    border-color: var(--primary-light);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.15);
    transform: translateX(3px);
}

.btn-icon-small {
    width: 32px;
    height: 32px;
    padding: 0;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.btn-icon-small.btn-edit {
    background: linear-gradient(135deg, #3B82F6, #2563EB);
    color: white;
    box-shadow: 0 2px 6px rgba(59, 130, 246, 0.3);
}

.btn-icon-small.btn-edit:hover {
    background: linear-gradient(135deg, #2563EB, #1D4ED8);
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.5);
}

.btn-icon-small.btn-delete {
    background: linear-gradient(135deg, #EF4444, #DC2626);
    color: white;
    box-shadow: 0 2px 6px rgba(239, 68, 68, 0.3);
}

.btn-icon-small.btn-delete:hover {
    background: linear-gradient(135deg, #DC2626, #B91C1C);
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.5);
}

.btn-icon-small:active {
    transform: scale(0.95);
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.02);
        box-shadow: 0 6px 20px rgba(99, 102, 241, 0.25);
    }
}

/* ========== N8N Settings ========== */

.n8n-settings {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 12px;
    padding: 1.25rem;
    margin-bottom: 2rem;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.25);
}

.n8n-settings-content {
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 1rem;
    align-items: center;
}

.n8n-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: white;
    font-weight: 600;
    font-size: 0.95rem;
}

.n8n-label svg {
    flex-shrink: 0;
}

.n8n-input {
    background: rgba(255, 255, 255, 0.95);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 8px;
    padding: 0.75rem 1rem;
    font-size: 0.95rem;
    color: #1a1a1a;
    transition: all 0.3s ease;
    font-family: 'Monaco', 'Courier New', monospace;
}

.n8n-input:focus {
    outline: none;
    border-color: rgba(255, 255, 255, 0.8);
    background: white;
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.2);
}

.n8n-input:disabled {
    background: rgba(255, 255, 255, 0.7);
    cursor: not-allowed;
    color: #333;
}

.n8n-input::placeholder {
    color: rgba(0, 0, 0, 0.4);
}

.btn-sm {
    padding: 0.6rem 1rem;
    font-size: 0.9rem;
}

.btn-success {
    background: linear-gradient(135deg, #10B981, #059669);
    color: white;
}

.btn-success:hover {
    background: linear-gradient(135deg, #059669, #047857);
}

.btn-danger {
    background: linear-gradient(135deg, #EF4444, #DC2626);
    color: white;
}

.btn-danger:hover {
    background: linear-gradient(135deg, #DC2626, #B91C1C);
}

