:root {
    --bg-color: #f4f7f6;
    --sidebar-bg: #ffffff;
    --text-color: #333;
    --primary-color: #007bff;
    --primary-hover: #0056b3;
    --border-color: #dee2e6;
    --success-color: #28a745;
    --danger-color: #dc3545;
    --warning-color: #ffc107;
    --info-color: #17a2b8;
    --rj45-blue: #2563eb;
    --dome-camera-color: #007fff;
    --router-color: #f39c12;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    overflow: hidden;
    height: 100vh;
}

/* Для страниц кабинета (userlk.php) — авто скролл */
body.page-cabinet {
    overflow: auto;
    height: auto;
    min-height: 100vh;
}

/* --- АВТОРИЗАЦИЯ --- */
#auth-container {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.auth-box {
    background: white;
    padding: 2.5rem;
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.1);
    width: 100%;
    max-width: 400px;
}

.auth-box h2 { margin-top: 0; margin-bottom: 1.5rem; text-align: center; }
.auth-box input {
    width: 100%;
    padding: 12px;
    margin-bottom: 1rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
}
.auth-box button {
    width: 100%;
    padding: 12px;
    border: none;
    background-color: var(--primary-color);
    color: white;
    font-size: 16px;
    border-radius: 6px;
    cursor: pointer;
}

.auth-switch {
    text-align: center;
    margin-top: 1rem;
    font-size: 14px;
    color: #666;
}
.auth-switch a { color: var(--primary-color); cursor: pointer; }

/* --- Кнопка Тарифы на странице входа/регистрации --- */
.auth-tariffs-btn {
    width: 100%;
    padding: 10px;
    margin-top: 6px;
    border: 2px solid var(--primary-color);
    border-radius: 6px;
    background: transparent;
    color: var(--primary-color);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, color 0.2s, box-shadow 0.2s;
}
.auth-tariffs-btn:hover {
    background: var(--primary-color);
    color: #fff;
    box-shadow: 0 4px 12px rgba(0, 102, 204, 0.3);
}

/* --- Модальное окно просмотра тарифов (для гостей) --- */
#guest-plans-modal {
    display: none;
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0,0,0,0.7);
    z-index: 10000;
    justify-content: center;
    align-items: center;
}
#guest-plans-modal.active { display: flex; }

.guest-plans-content {
    background: white;
    padding: 30px;
    border-radius: 16px;
    max-width: 800px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
}

.guest-plans-content h2 {
    text-align: center;
    margin-bottom: 10px;
    color: #333;
}

.guest-plans-content .subtitle {
    text-align: center;
    color: #666;
    margin-bottom: 30px;
}

.guest-plans-content .close-modal {
    position: absolute;
    top: 12px;
    right: 16px;
    font-size: 28px;
    color: #999;
    cursor: pointer;
    line-height: 1;
}
.guest-plans-content .close-modal:hover { color: #333; }

.guest-plans-footer {
    text-align: center;
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid #eee;
    font-size: 13px;
    color: #888;
}

/* Read-only карточка тарифа — без курсора pointer и без hover-эффекта выбора */
.plan-card-readonly {
    cursor: default !important;
}
.plan-card-readonly:hover {
    transform: none !important;
    box-shadow: none !important;
    border-color: #e0e0e0 !important;
}
.plan-card-readonly.popular:hover {
    border-color: var(--warning-color) !important;
    background: linear-gradient(to bottom, #fff, #fffaf0) !important;
}

/* Inline-редактор описания объекта на плане */
.callout-inline-editor {
    transition: none !important;
}
.callout-inline-editor:focus {
    border-color: #2980b9 !important;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.3), 0 2px 8px rgba(0,0,0,0.2) !important;
}

.alert {
    padding: 10px;
    border-radius: 4px;
    margin-bottom: 1rem;
    font-size: 14px;
}
.alert-error { background: #fee; color: #c33; }
.alert-success { background: #efe; color: #3c3; }

/* --- ПЛАВАЮЩЕЕ ОКНО ПРОБНОГО ПЕРИОДА --- */
.trial-float-banner {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(90deg, #ff6b6b, #ee5a6f);
    color: white;
    padding: 12px 24px;
    border-radius: 30px;
    box-shadow: 0 4px 15px rgba(238, 90, 111, 0.4);
    z-index: 9999;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    white-space: nowrap;
    display: none;
    animation: pulse 2s infinite;
}

.trial-float-banner.active { display: block; }

@keyframes pulse {
    0% { box-shadow: 0 4px 15px rgba(238, 90, 111, 0.4); }
    50% { box-shadow: 0 4px 25px rgba(238, 90, 111, 0.7); }
    100% { box-shadow: 0 4px 15px rgba(238, 90, 111, 0.4); }
}

/* --- МОДАЛЬНОЕ ОКНО ПОДПИСКИ --- */
#subscription-modal {
    display: none;
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0,0,0,0.7);
    z-index: 10000;
    justify-content: center;
    align-items: center;
}

#subscription-modal.active { display: flex; }

.subscription-content {
    background: white;
    padding: 30px;
    border-radius: 16px;
    max-width: 800px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
}

.subscription-content h2 {
    text-align: center;
    margin-bottom: 10px;
    color: #333;
}

.subscription-content .subtitle {
    text-align: center;
    color: #666;
    margin-bottom: 30px;
}

.plans-slider-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    margin-bottom: 20px;
}

.plans-grid {
    display: flex;
    gap: 20px;
    overflow-x: auto;
    scroll-behavior: smooth;
    scroll-snap-type: x mandatory;
    padding: 10px 4px 16px 4px;
    flex: 1;
    -ms-overflow-style: none;
    scrollbar-width: none;
}

.plans-grid::-webkit-scrollbar {
    display: none;
}

.plans-slider-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 50%;
    background: #ffffff;
    color: #333;
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    z-index: 5;
    transition: background 0.2s, box-shadow 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.plans-slider-arrow:hover {
    background: #f0f0f0;
    box-shadow: 0 4px 12px rgba(0,0,0,0.25);
}

.plans-slider-left {
    left: -4px;
}

.plans-slider-right {
    right: -4px;
}

.plan-card {
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    padding: 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
    position: relative;
    flex: 0 0 220px;
    min-width: 220px;
    scroll-snap-align: start;
}

.plan-card:hover {
    border-color: var(--primary-color);
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0,0,0,0.1);
}

.plan-card.popular {
    border-color: var(--warning-color);
    background: linear-gradient(to bottom, #fff, #fffaf0);
}

.plan-card.popular::before {
    content: 'ПОПУЛЯРНЫЙ';
    position: absolute;
    top: -12px;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(135deg, #ff9800, #f57c00);
    color: #fff;
    padding: 4px 14px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: bold;
    letter-spacing: 0.5px;
    box-shadow: 0 2px 6px rgba(255,152,0,0.4);
    white-space: nowrap;
}

.plan-duration {
    font-size: 24px;
    font-weight: bold;
    color: #333;
    margin-bottom: 5px;
}

.plan-buyers {
    font-size: 11px;
    color: #888;
    margin-bottom: 2px;
}

.plan-price {
    margin: 12px 0 4px 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}

.plan-price-old {
    font-size: 14px;
    color: #999;
    text-decoration: line-through;
    font-weight: normal;
}

.plan-price-value {
    font-size: 28px;
    color: var(--primary-color);
    font-weight: bold;
    line-height: 1.2;
    word-break: break-word;
    text-align: center;
}

.plan-price-value .plan-price-unit {
    font-size: 14px;
    color: #666;
    font-weight: normal;
}

.plan-price-period {
    font-size: 12px;
    color: #888;
    margin-top: 2px;
}

.plan-features {
    list-style: none;
    padding: 0;
    margin: 8px 0 0 0;
    font-size: 13px;
    color: #555;
    text-align: left;
}

.plan-features li {
    margin: 5px 0;
    padding-left: 20px;
    position: relative;
    line-height: 1.4;
}

.plan-features li::before {
    content: '\2713';
    position: absolute;
    left: 0;
    color: #28a745;
    font-weight: bold;
    font-size: 13px;
}

.plan-features li.disabled::before {
    content: '\2717';
    color: #dc3545;
}

.plan-features li.disabled {
    color: #999;
}

/* --- ЛИЧНЫЙ КАБИНЕТ --- */
#dashboard {
    display: none;
    padding: 24px 24px 40px 24px;
    max-width: 1200px;
    margin: 0 auto;
}

#dashboard.active { display: block; }

.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 20px;
    border-bottom: 2px solid var(--border-color);
}

.project-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.project-card {
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 0;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.project-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

/* Миниатюра проекта */
.project-thumb {
    width: 100%;
    height: 160px;
    overflow: hidden;
    background: #f5f5f5;
    display: flex;
    align-items: center;
    justify-content: center;
    border-bottom: 1px solid var(--border-color);
}

.project-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.project-thumb-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
}

/* Информация о проекте */
.project-info {
    padding: 14px 16px 8px;
}

.project-info h3 {
    margin: 0 0 4px 0;
    font-size: 15px;
    color: #2c3e50;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.project-date {
    font-size: 12px;
    color: #999;
}

/* Кнопки действий */
.project-actions {
    display: flex;
    gap: 8px;
    padding: 8px 16px 14px;
    margin-top: auto;
}

.btn-project {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 6px 14px;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
    line-height: 1;
}

.btn-project:active {
    transform: scale(0.96);
}

.btn-download {
    background: #e8f5e9;
    color: #2e7d32;
}

.btn-download:hover {
    background: #c8e6c9;
}

.btn-download svg {
    flex-shrink: 0;
}

.btn-delete {
    background: #fce4ec;
    color: #c62828;
    margin-left: auto;
}

.btn-delete:hover {
    background: #ef9a9a;
}

.btn-delete svg {
    flex-shrink: 0;
}

.new-project-card {
    border: 2px dashed var(--border-color);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 280px;
    color: var(--primary-color);
}

/* --- ОСНОВНОЕ ПРИЛОЖЕНИЕ --- */
#app { 
    display: none; 
    height: 100vh;
    position: relative;
}
#app.active { display: flex; }

/* proet.php загружает #app как единственный контент — он всегда active */

/* --- САЙДБАР --- */
#sidebar { 
    width: 350px; 
    min-width: 350px;
    background-color: var(--sidebar-bg); 
    border-right: 1px solid var(--border-color); 
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    position: relative;
    transition: margin-left 0.3s ease, opacity 0.3s ease;
}

/* Скрытый сайдбар */
#sidebar.collapsed {
    margin-left: -350px;
    opacity: 0;
    pointer-events: none;
    position: absolute;
    z-index: -1;
}

/* Кнопка скрытия сайдбара — снаружи aside, на правой границе сайдбара, посередине */
#sidebar-toggle-close {
    position: absolute;
    left: 349px;
    top: 50%;
    transform: translateY(-50%);
    width: 36px;
    height: 85px;
    border: none;
    background: #ffffff;
    border-radius: 0 6px 6px 0;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #666;
    font-size: 14px;
    z-index: 10;
    box-shadow: 4px 0 12px rgba(0, 0, 0, 0.25);
    transition: background 0.2s, color 0.2s, box-shadow 0.2s, left 0.3s ease;
}
#sidebar-toggle-close:hover {
    background: #f0f0f0;
    color: #333;
    box-shadow: 4px 0 18px rgba(0, 0, 0, 0.35);
}
/* Когда сайдбар скрыт — кнопка закрытия прячется через JS */

/* Стрелка-кнопка для открытия сайдбара (снаружи, слева) */
#sidebar-toggle-open {
    position: fixed;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 36px;
    height: 85px;
    border: none;
    border-radius: 0 6px 6px 0;
    background: #ffffff;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    color: #666;
    font-size: 14px;
    z-index: 1000;
    box-shadow: -4px 0 12px rgba(0, 0, 0, 0.25);
    transition: background 0.2s, color 0.2s, box-shadow 0.2s;
}
#sidebar-toggle-open:hover {
    background: #f0f0f0;
    color: #333;
    box-shadow: -4px 0 18px rgba(0, 0, 0, 0.35);
}
#sidebar-toggle-open.visible {
    display: flex;
}

.sidebar-section { 
    border-bottom: 1px solid var(--border-color); 
    padding-bottom: 20px; 
    margin-bottom: 20px;
}
.sidebar-section:last-child { border-bottom: none; }
.sidebar-section h3 { margin-top: 0; }

.project-name-input {
    width: 100%;
    padding: 10px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 16px;
    font-weight: bold;
    margin-bottom: 10px;
}

.btn {
    width: 100%;
    padding: 10px;
    margin-bottom: 10px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
}
.btn-primary { background: var(--primary-color); color: white; }
.btn-success { background: var(--success-color); color: white; }
.btn-danger { background: var(--danger-color); color: white; }
.btn-warning { background: var(--warning-color); color: #000; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* Уведомление о заблокированном тарифе */
.tariff-lock-notice {
    background: #fff3cd;
    border: 1px solid #ffc107;
    color: #856404;
    font-size: 12px;
    padding: 6px 10px;
    border-radius: 4px;
    margin-top: 8px;
    text-align: center;
    font-weight: 500;
}

/* --- КНОПКА ЗАГРУЗКИ --- */
.file-upload-wrapper {
    position: relative;
    overflow: hidden;
    display: inline-block;
    width: 100%;
}

.file-upload-wrapper input[type=file] {
    position: absolute;
    left: -9999px;
}

.file-upload-label {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    padding: 12px 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    font-size: 14px;
    transition: all 0.3s;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    border: 2px dashed rgba(255,255,255,0.3);
}

.file-upload-label:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0,0,0,0.15);
    background: linear-gradient(135deg, #5568d3 0%, #653e9a 100%);
}

.file-upload-label i {
    font-size: 20px;
}

/* --- КАНВАС --- */
#canvas-container { 
    flex-grow: 1; 
    position: relative; 
    overflow: hidden; 
    background-color: #e0e0e0; 
}

#canvas-wrapper { 
    position: absolute;
    box-shadow: 0 0 20px rgba(0,0,0,0.2); 
}

#plan-canvas-bg, #plan-canvas-overlay { 
    position: absolute; 
    top: 0; 
    left: 0; 
}
#plan-canvas-bg { z-index: 1; }
#plan-canvas-overlay { 
    z-index: 2; 
    cursor: grab; 
}
#plan-canvas-overlay:active { cursor: grabbing; }
#plan-canvas-overlay.panning { cursor: move; }
#plan-canvas-overlay.drawing-mode,
#plan-canvas-overlay.cable-mode { cursor: crosshair; }

/* --- СПИСКИ --- */
#camera-list, #socket-list, #cabinet-list, #router-list, #annotation-list { list-style: none; padding: 0; margin: 0; }
.camera-item, .socket-item, .cabinet-item, .router-item, .annotation-item { 
    background: #f8f9fa; 
    border: 1px solid var(--border-color); 
    padding: 10px; 
    margin-bottom: 8px; 
    border-radius: 4px; 
    cursor: move; 
    display: flex;
    align-items: center;
    gap: 12px;
}

/* --- SVG ИКОНКИ --- */
.camera-icon-svg, .socket-icon-svg, .cabinet-icon-svg, .router-icon-svg {
    width: 40px;
    height: 40px;
    flex-shrink: 0;
}

.camera-icon-svg path, .socket-icon-svg path, .cabinet-icon-svg path, .router-icon-svg path {
    stroke: #0066cc;
}

/* --- ИНФО ПАНЕЛЬ --- */
#info-panel { 
    position: absolute; 
    top: 60px; 
    left: 10px; 
    background: rgba(255,255,255,0.95); 
    padding: 10px 15px; 
    border-radius: 6px; 
    font-size: 14px; 
    font-weight: 600;
    pointer-events: none; 
    z-index: 10; 
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    border: 1px solid var(--border-color);
}

/* --- БЛОК ПОЛЬЗОВАТЕЛЯ И СПРАВКИ --- */
.user-menu {
    position: absolute;
    top: 60px;
    right: 10px;
    background: white;
    padding: 15px;
    border-radius: 8px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.15);
    z-index: 100;
    min-width: 240px;
    max-width: 280px;
    border: 1px solid var(--border-color);
    max-height: calc(100vh - 80px);
    overflow-y: auto;
}

/* Блок справки */
.help-block {
    margin-top: 10px;
}

.help-block h4 {
    font-size: 13px;
    color: #495057;
    margin-bottom: 10px;
    padding-bottom: 6px;
    border-bottom: 1px solid #e9ecef;
    font-weight: 600;
}

.help-section-title {
    font-size: 11px;
    font-weight: bold;
    color: #495057;
    margin-top: 12px;
    margin-bottom: 6px;
    padding: 4px 6px;
    background: #f8f9fa;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.help-item {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 5px;
    font-size: 12px;
    gap: 8px;
}

.help-key {
    background: #e9ecef;
    border: 1px solid #ced4da;
    border-radius: 4px;
    padding: 2px 6px;
    font-weight: 600;
    color: #495057;
    font-family: monospace;
    font-size: 11px;
    white-space: nowrap;
    flex-shrink: 0;
}

.help-desc {
    color: #6c757d;
    text-align: right;
    line-height: 1.3;
    font-size: 11px;
}

/* --- ВЫДЕЛЕНИЕ --- */
.selection-active {
    outline: 2px solid #007bff;
    outline-offset: -2px;
}

.close-modal {
    float: right;
    font-size: 28px;
    cursor: pointer;
    color: #999;
}
.close-modal:hover { color: #333; }

/* --- КАСТОМНЫЕ УВЕДОМЛЕНИЯ (вместо alert/confirm) --- */
.cctv-toast {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    min-width: 320px;
    max-width: 480px;
    background: #ffffff;
    border-radius: 14px;
    box-shadow: 0 12px 40px rgba(0,0,0,0.25);
    z-index: 99999;
    padding: 28px 32px 24px;
    text-align: center;
    animation: cctv-toast-in 0.25s ease-out;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
@keyframes cctv-toast-in {
    from { opacity: 0; transform: translate(-50%, -50%) scale(0.92); }
    to   { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}
.cctv-toast-icon {
    font-size: 42px;
    margin-bottom: 12px;
    line-height: 1;
}
.cctv-toast-icon.success { color: #28a745; }
.cctv-toast-icon.error   { color: #dc3545; }
.cctv-toast-icon.warning { color: #ffc107; }
.cctv-toast-icon.info    { color: #007bff; }
.cctv-toast-title {
    font-size: 18px;
    font-weight: 700;
    color: #333;
    margin-bottom: 8px;
}
.cctv-toast-message {
    font-size: 14px;
    color: #555;
    line-height: 1.5;
    margin-bottom: 20px;
}
.cctv-toast-buttons {
    display: flex;
    gap: 10px;
    justify-content: center;
}
.cctv-toast-btn {
    padding: 9px 28px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
}
.cctv-toast-btn:active { transform: scale(0.96); }
.cctv-toast-btn.primary {
    background: #007bff;
    color: #fff;
}
.cctv-toast-btn.primary:hover { background: #0056b3; }
.cctv-toast-btn.success {
    background: #28a745;
    color: #fff;
}
.cctv-toast-btn.success:hover { background: #218838; }
.cctv-toast-btn.danger {
    background: #dc3545;
    color: #fff;
}
.cctv-toast-btn.danger:hover { background: #c82333; }
.cctv-toast-btn.cancel {
    background: #e9ecef;
    color: #333;
}
.cctv-toast-btn.cancel:hover { background: #d5d8db; }
.cctv-toast-overlay {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0,0,0,0.4);
    z-index: 99998;
    animation: cctv-overlay-in 0.2s ease-out;
}
@keyframes cctv-overlay-in {
    from { opacity: 0; }
    to   { opacity: 1; }
}

/* --- ФОРМЫ --- */
.form-label {
    font-size: 12px;
    color: #555;
    margin-bottom: 4px;
    display: block;
    font-weight: 600;
}

/* --- ПОЛЗУНКИ --- */
.size-value {
    text-align: center;
    font-weight: bold;
    color: var(--primary-color);
    margin-top: 5px;
    font-size: 13px;
}

[data-tooltip] {
    position: relative;
    cursor: help;
}

[data-tooltip]:hover::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.9);
    color: white;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 12px;
    white-space: nowrap;
    z-index: 10000;
    pointer-events: none;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    max-width: 250px;
    white-space: normal;
    line-height: 1.4;
}

[data-tooltip]:hover::before {
    content: '';
    position: absolute;
    bottom: calc(100% + 2px);
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-top-color: rgba(0, 0, 0, 0.9);
    z-index: 10000;
}

/* --- ПАНЕЛИ СВОЙСТВ --- */
#cabinet-properties {
    border-color: #e74c3c !important;
}

#cabinet-properties h3 {
    color: #e74c3c;
}

#router-properties {
    border-color: #f39c12 !important;
}

#router-properties h3 {
    color: #f39c12;
}
/* --- КАПЧА --- */
.captcha-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 1rem;
}
.captcha-row input {
    font-size: 16px;
    letter-spacing: 3px;
    text-transform: uppercase;
}
.captcha-img {
    height: 46px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    cursor: pointer;
    flex-shrink: 0;
    transition: opacity 0.2s;
}
.captcha-img:hover {
    opacity: 0.7;
}

/* --- БЛОКИРОВКА ПОДБОРА ПАРОЛЯ (модальное окно) --- */
.bf-block-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: #f4f7f6;
    z-index: 99999;
    align-items: center;
    justify-content: center;
}
.bf-block-overlay.active {
    display: flex;
}
.bf-block-box {
    background: #fff;
    border-radius: 12px;
    padding: 36px 32px;
    width: 90%;
    max-width: 440px;
    text-align: center;
}
.bf-block-icon {
    font-size: 52px;
    margin-bottom: 16px;
}
.bf-block-box h3 {
    color: #dc3545;
    margin: 0 0 12px 0;
    font-size: 20px;
}
.bf-block-box p {
    color: #555;
    font-size: 14px;
    line-height: 1.6;
    margin-bottom: 8px;
}
.bf-block-timer {
    font-size: 28px;
    font-weight: bold;
    color: #dc3545;
    margin: 16px 0;
    font-variant-numeric: tabular-nums;
}
.bf-block-support {
    background: #f8d7da;
    border: 1px solid #f5c6cb;
    border-radius: 8px;
    padding: 12px 16px;
    margin-top: 16px;
    font-size: 13px;
    color: #721c24;
    line-height: 1.5;
}

/* --- MY ORDERS MODAL --- */
#my-orders-modal { display:none; position:fixed; top:0; left:0; width:100%; height:100%; background:rgba(0,0,0,0.7); z-index:10001; justify-content:center; align-items:center; }
#my-orders-modal.active { display:flex; }
.my-orders-content { background:white; padding:30px; border-radius:16px; max-width:850px; width:92%; max-height:85vh; overflow-y:auto; }
.my-orders-content h2 { text-align:center; margin-bottom:16px; color:#333; }
.my-orders-table { width:100%; border-collapse:collapse; font-size:14px; }
.my-orders-table th { background:#f0f4ff; padding:10px 12px; text-align:left; font-weight:600; color:#1a3a6b; border-bottom:2px solid #c5d5f0; }
.my-orders-table td { padding:10px 12px; border-bottom:1px solid #eee; }
.my-orders-table tr:hover { background:#f8f9fa; }
.order-badge { display:inline-block; padding:3px 10px; border-radius:12px; font-size:12px; font-weight:600; }
.order-badge-pending { background:#fff3cd; color:#856404; }
.order-badge-payment_sent { background:#cce5ff; color:#004085; }
.order-badge-paid { background:#d4edda; color:#155724; }
.order-badge-cancelled { background:#f8d7da; color:#721c24; }
.order-instructions { background:#f0f4ff; border:1px solid #c5d5f0; border-radius:8px; padding:12px; margin-top:8px; font-size:13px; color:#333; white-space:pre-wrap; }

/* --- INFO POPUP --- */
#site-info-overlay { position:fixed; inset:0; background:rgba(0,0,0,0); z-index:10002; display:flex; justify-content:center; align-items:center; opacity:0; pointer-events:none; transition: opacity 0.4s ease, background 0.4s ease; }
#site-info-overlay.active { opacity:1; pointer-events:auto; background:rgba(0,0,0,0.5); }
#site-info-box { background:white; border-radius:16px; padding:32px; max-width:520px; width:90%; max-height:80vh; overflow-y:auto; position:relative; transform:translateY(-40px) scale(0.95); transition: transform 0.5s cubic-bezier(0.34,1.56,0.64,1), opacity 0.4s ease; opacity:0; box-shadow:0 20px 60px rgba(0,0,0,0.3); }
#site-info-overlay.active #site-info-box { transform:translateY(0) scale(1); opacity:1; }
#site-info-box h3 { margin:0 0 14px 0; color:#1a3a6b; font-size:20px; display:flex; align-items:center; gap:10px; }
#site-info-box .info-text { color:#444; font-size:15px; line-height:1.7; white-space:pre-wrap; }
#site-info-close { position:absolute; top:14px; right:16px; background:none; border:none; font-size:24px; cursor:pointer; color:#999; width:36px; height:36px; border-radius:50%; display:flex; align-items:center; justify-content:center; transition:background 0.2s; }
#site-info-close:hover { background:#f0f0f0; color:#333; }
#site-info-fab { position:fixed; bottom:24px; right:24px; width:52px; height:52px; background:linear-gradient(135deg,#0066cc,#004499); border-radius:50%; display:none; align-items:center; justify-content:center; cursor:pointer; box-shadow:0 4px 16px rgba(0,102,204,0.4); z-index:10001; transition:transform 0.3s, box-shadow 0.3s; }
#site-info-fab:hover { transform:scale(1.1); box-shadow:0 6px 24px rgba(0,102,204,0.5); }
#site-info-fab span { color:white; font-size:26px; font-weight:bold; font-family:Arial,sans-serif; display:inline-block; animation:fabRotate 8s linear infinite; }
@keyframes fabRotate { 0% { transform:rotate(0deg); } 100% { transform:rotate(360deg); } }

/* --- CALCULATION MODAL --- */
#calculation-modal { display:none; position:fixed; top:0; left:0; width:100%; height:100%; background:rgba(0,0,0,0.7); z-index:10001; justify-content:center; align-items:center; }
#calculation-modal.active { display:flex; }
.calc-modal-content { background:white; padding:30px; border-radius:16px; max-width:900px; width:92%; max-height:85vh; overflow-y:auto; position:relative; }
.calc-table { width:100%; border-collapse:collapse; font-size:14px; margin-top:10px; }
.calc-table th { background:#f0f4ff; padding:10px 12px; text-align:left; font-weight:600; color:#1a3a6b; border-bottom:2px solid #c5d5f0; font-size:13px; }
.calc-table td { padding:8px 10px; border-bottom:1px solid #eee; }
.calc-table tfoot td { border-top:2px solid #c5d5f0; padding-top:12px; }
.calc-table input[type="number"] { width:100%; padding:6px 8px; border:1px solid #ced4da; border-radius:4px; font-size:13px; box-sizing:border-box; }

/* --- CALC EDIT MODAL --- */
#calc-edit-modal { display:none; position:fixed; top:0; left:0; width:100%; height:100%; background:rgba(0,0,0,0.7); z-index:10002; justify-content:center; align-items:center; }
#calc-edit-modal.active { display:flex; }

/* --- CALC SHEETS MODAL --- */
#calc-sheets-modal { display:none; position:fixed; top:0; left:0; width:100%; height:100%; background:rgba(0,0,0,0.7); z-index:10001; justify-content:center; align-items:center; }
#calc-sheets-modal.active { display:flex; }

/* --- CALC ACTION BUTTONS --- */
.calc-action-btn { display:inline-block; padding:5px 12px; border:none; border-radius:6px; font-size:12px; font-weight:600; cursor:pointer; transition:all 0.2s; margin:2px; }
.calc-action-download { background:#28a745; color:white; }
.calc-action-download:hover { background:#218838; }
.calc-action-edit { background:#ffc107; color:#333; }
.calc-action-edit:hover { background:#e0a800; }
.calc-action-delete { background:#dc3545; color:white; }
.calc-action-delete:hover { background:#c82333; }
