/* Основные стили */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Видео фон */
#backgroundVideo {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    object-fit: cover;
    z-index: -1;
    opacity: 0.3;
    transition: opacity 0.5s ease;
}

/* Fallback для браузеров без поддержки видео */
body:not(.video-supported) {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    background-attachment: fixed;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
    overflow-x: hidden;
    overflow-y: auto;
}

@media (max-width: 768px) {
    body {
        overflow-x: hidden;
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch;
        position: relative;
    }
    
    html {
        overflow-x: hidden;
        overflow-y: auto !important;
        position: relative;
    }
}

.container {
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    padding: 15px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    position: relative;
}

@media (max-width: 768px) {
    .container {
        padding: 5px;
        min-height: auto;
        display: block;
    }
}

/* Форма авторизации */
.login-form {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 40px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    max-width: 400px;
    margin: auto;
    animation: slideIn 0.6s ease-out;
    width: 100%;
}

.insecure-warning {
    border-radius: 16px;
    border: 1px solid #f0ad4e;
    background: rgba(255, 243, 205, 0.95);
    padding: 24px;
    text-align: center;
    color: #7a5a00;
    line-height: 1.5;
}

.insecure-warning h2 {
    font-size: 1.3em;
    margin-bottom: 12px;
}

.insecure-warning p {
    margin-bottom: 12px;
}

.insecure-warning a {
    color: #1b6ef3;
    font-weight: 600;
    text-decoration: underline;
}

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

.logo {
    text-align: center;
    margin-bottom: 30px;
}

.logo-image {
    max-width: 120px;
    max-height: 120px;
    width: auto;
    height: auto;
    border-radius: 15px;
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.3);
    margin-bottom: 15px;
    transition: all 0.3s ease;
    object-fit: contain;
}

.logo-image:hover {
    transform: scale(1.05);
    box-shadow: 0 12px 35px rgba(102, 126, 234, 0.4);
}

.logo h1 {
    font-size: 2.5em;
    color: #667eea;
    margin-bottom: 10px;
    font-weight: 700;
    text-shadow: 0 2px 4px rgba(102, 126, 234, 0.2);
}

.logo p {
    color: #666;
    font-size: 1.1em;
    font-weight: 500;
}

/* Ссылка на сайт */
.website-link {
    margin-top: 30px;
    text-align: center;
    padding-top: 20px;
    border-top: 1px solid rgba(102, 126, 234, 0.2);
}

.website-link a {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: #667eea;
    text-decoration: none;
    font-size: 0.9em;
    font-weight: 500;
    padding: 8px 16px;
    border-radius: 20px;
    background: rgba(102, 126, 234, 0.1);
    transition: all 0.3s ease;
    border: 1px solid rgba(102, 126, 234, 0.2);
}

.website-link a:hover {
    background: rgba(102, 126, 234, 0.2);
    border-color: rgba(102, 126, 234, 0.4);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.website-icon {
    font-size: 1.1em;
}

.website-text {
    font-size: 0.85em;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #555;
}

.form-group input[type="text"],
.form-group input[type="password"] {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e1e5e9;
    border-radius: 10px;
    font-size: 16px;
    transition: all 0.3s ease;
    background: #fff;
}

.form-group input[type="text"]:focus,
.form-group input[type="password"]:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
    transform: translateY(-2px);
}

.checkbox-group {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-direction: row;
    justify-content: flex-start;
}

.checkbox-group input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: #667eea;
    margin: 0;
    flex-shrink: 0;
    order: 1;
}

.checkbox-group label {
    margin: 0;
    cursor: pointer;
    user-select: none;
    order: 2;
    font-size: 0.95em;
    color: #666;
}

.btn {
    width: 100%;
    padding: 14px;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(102, 126, 234, 0.3);
}

.btn-primary:active {
    transform: translateY(0);
}


@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

/* Панель управления */
.dashboard {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 25px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    animation: fadeIn 0.6s ease-out;
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    width: 100%;
    max-width: 100%;
}

@media (max-width: 768px) {
    .dashboard {
        padding: 8px;
    }
}

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

.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid #e1e5e9;
    flex-shrink: 0;
    background: rgba(255, 255, 255, 0.95);
    padding: 15px 20px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.header-logo {
    display: flex;
    align-items: center;
    gap: 15px;
    flex: 1;
}

.header-logo img {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.2);
    object-fit: contain;
    transition: all 0.3s ease;
}

.header-logo img:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.header h1 {
    color: #667eea;
    font-size: 1.3em;
    font-weight: 600;
    margin: 0;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-left: auto;
    margin-right: 15px;
    padding: 6px 10px;
    background: rgba(102, 126, 234, 0.1);
    border-radius: 8px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(102, 126, 234, 0.2);
    transition: all 0.3s ease;
    min-width: 280px;
}

.user-info:hover {
    background: rgba(102, 126, 234, 0.15);
    border-color: rgba(102, 126, 234, 0.3);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.2);
}

.user-role {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white !important;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 0.7em;
    font-weight: 600;
    box-shadow: 0 2px 6px rgba(102, 126, 234, 0.3);
    transition: all 0.3s ease;
    white-space: nowrap;
    position: relative;
    margin-right: 2px;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
    letter-spacing: 0.2px;
}

.user-role:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

.user-info span:not(.user-role) {
    color: white !important;
    font-size: 0.75em;
    font-weight: 500;
    white-space: nowrap;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
    position: relative;
    padding-left: 10px;
    letter-spacing: 0.2px;
    background: rgba(0, 0, 0, 0.1);
    padding: 4px 8px;
    border-radius: 6px;
    backdrop-filter: blur(5px);
}

.user-info span:not(.user-role)::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 1px;
    height: 20px;
    background: rgba(255, 255, 255, 0.3);
}

.logout-btn {
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5a52 100%);
    color: white !important;
    border: none;
    padding: 6px 12px;
    border-radius: 15px;
    cursor: pointer;
    font-size: 0.8em;
    font-weight: 600;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(255, 107, 107, 0.3);
    white-space: nowrap;
    position: relative;
    margin-left: 5px;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
    letter-spacing: 0.3px;
}

.logout-btn::before {
    content: '';
    position: absolute;
    left: -15px;
    top: 50%;
    transform: translateY(-50%);
    width: 1px;
    height: 20px;
    background: rgba(255, 255, 255, 0.3);
}

.logout-btn:hover {
    background: linear-gradient(135deg, #ff5252 0%, #e53935 100%);
    color: white !important;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 107, 107, 0.4);
}

/* Навигация */
.nav-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 25px;
    flex-wrap: wrap;
    flex-shrink: 0;
}

.nav-tab {
    background: #f8f9fa;
    border: 2px solid #e1e5e9;
    padding: 12px 24px;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 600;
    color: #666;
}

.nav-tab.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-color: #667eea;
}

.nav-tab:hover:not(.active) {
    background: #e9ecef;
    transform: translateY(-2px);
}

/* Таблицы */
.table-container {
    background: white;
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    margin-bottom: 20px;
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.table-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.table-header h3 {
    margin: 0;
    font-size: 1.3em;
}

.table-actions {
    display: flex;
    gap: 10px;
}

.btn-small {
    padding: 8px 16px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
    font-size: 0.9em;
}

.btn-success {
    background: #28a745;
    color: white;
}

.btn-warning {
    background: #ffc107;
    color: #333;
}

.btn-danger {
    background: #dc3545;
    color: white;
}

/* Специальные стили для кнопки "Удалить" */
.btn-danger {
    background: linear-gradient(135deg, #dc3545 0%, #c82333 100%) !important;
    color: white !important;
    border: 1px solid #bd2130 !important;
    padding: 6px 12px !important;
    margin: 2px !important;
    border-radius: 4px !important;
    font-size: 12px !important;
    cursor: pointer !important;
    z-index: 10 !important;
    position: relative !important;
    min-width: 70px !important;
    white-space: nowrap !important;
    overflow: visible !important;
    text-overflow: unset !important;
    display: inline-block !important;
    visibility: visible !important;
    opacity: 1 !important;
}

.btn-info {
    background: #17a2b8;
    color: white;
}

.btn-small:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

/* Контейнер для содержимого таблицы */
.table-content {
    flex: 1;
    overflow: auto;
    min-height: 0;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.95em;
    min-width: 100%;
    table-layout: fixed;
}

.data-table th,
.data-table td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid #e1e5e9;
}

.data-table th {
    background: #f8f9fa;
    font-weight: 600;
    color: #555;
    position: sticky;
    top: 0;
    z-index: 10;
}

.data-table tr:hover {
    background: #f8f9fa;
}

.data-table tr:nth-child(even) {
    background: #fafbfc;
}

/* Модальные окна */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(5px);
}

.modal-content {
    background: white;
    margin: 5% auto;
    padding: 30px;
    border-radius: 20px;
    width: 90%;
    max-width: 600px;
    max-height: 80vh;
    overflow-y: auto;
    animation: modalSlideIn 0.3s ease-out;
}

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

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid #e1e5e9;
}

.modal-header h2 {
    color: #667eea;
    margin: 0;
}

.close {
    color: #aaa;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    transition: color 0.3s ease;
}

.close:hover {
    color: #ff6b6b;
}

/* Формы в модальных окнах */
.form-row {
    display: flex;
    gap: 15px;
    margin-bottom: 20px;
}

.form-row .form-group {
    flex: 1;
    margin-bottom: 0;
}

/* Адаптивность */
@media (max-width: 1200px) {
    .container {
        max-width: 100%;
        padding: 10px;
    }
    
    .dashboard {
        padding: 20px;
    }
    
    .table-header {
        flex-direction: column;
        gap: 15px;
        align-items: flex-start;
    }
    
    .table-actions {
        width: 100%;
        justify-content: flex-start;
        flex-wrap: wrap;
    }
}

@media (max-width: 768px) {
    .container {
        padding: 5px;
        max-width: 100%;
        overflow-x: hidden;
    }
    
    .login-form {
        padding: 25px 15px;
        margin: 5px;
        max-width: 100%;
    }
    
    .logo-image {
        max-width: 70px;
        max-height: 70px;
        margin-bottom: 10px;
    }
    
    .logo h1 {
        font-size: 1.8em;
    }
    
    .logo p {
        font-size: 0.95em;
    }
    
    .website-link {
        margin-top: 15px;
        padding-top: 12px;
    }
    
    .website-link a {
        font-size: 0.75em;
        padding: 6px 10px;
    }
    
    /* Dashboard - убираем ограничения высоты */
    .dashboard {
        padding: 8px;
        border-radius: 12px;
        display: block;
        width: 100%;
        max-width: 100%;
        min-height: auto;
        overflow: visible;
        margin: 0;
    }
    
    /* Header - компактный, всегда видимый */
    .header {
        flex-direction: column;
        gap: 8px;
        text-align: center;
        margin-bottom: 12px;
        padding: 10px;
        position: sticky;
        top: 0;
        z-index: 100;
        background: rgba(255, 255, 255, 0.98);
        backdrop-filter: blur(10px);
        border-radius: 10px;
        box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    }
    
    .header-logo {
        justify-content: center;
        margin-bottom: 8px;
    }
    
    .header-logo img {
        width: 32px;
        height: 32px;
    }
    
    .header h1 {
        font-size: 1.3em;
        margin: 0;
        line-height: 1.2;
    }
    
    .user-info {
        flex-direction: column;
        gap: 10px;
        margin: 10px auto 0;
        padding: 12px;
        background: rgba(255, 255, 255, 0.95);
        backdrop-filter: blur(10px);
        min-width: auto;
        width: 100%;
        max-width: 280px;
        border-radius: 8px;
        box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    }
    
    .user-info span:not(.user-role)::before,
    .logout-btn::before {
        display: none;
    }
    
    .user-info span:not(.user-role) {
        padding-left: 0;
        text-align: center;
        color: #333 !important;
        font-size: 0.85em;
    }
    
    .user-role {
        font-size: 0.75em;
        padding: 4px 8px;
    }
    
    .logout-btn {
        margin-left: 0;
        width: 100%;
        justify-content: center;
        color: white !important;
        padding: 8px;
        font-size: 0.85em;
    }
    
    /* Навигационные вкладки - горизонтальная прокрутка */
    .nav-tabs {
        display: flex !important;
        flex-wrap: wrap !important;
        gap: 6px !important;
        margin-bottom: 12px !important;
        padding: 5px 0 !important;
        overflow-x: auto !important;
        overflow-y: visible !important;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: thin;
        width: 100% !important;
        max-width: 100% !important;
        justify-content: center !important;
        visibility: visible !important;
        opacity: 1 !important;
        position: relative !important;
        z-index: 10 !important;
    }
    
    .nav-tabs::-webkit-scrollbar {
        height: 4px;
    }
    
    .nav-tabs::-webkit-scrollbar-track {
        background: transparent;
    }
    
    .nav-tabs::-webkit-scrollbar-thumb {
        background: #667eea;
        border-radius: 2px;
    }
    
    .nav-tab {
        padding: 10px 14px !important;
        font-size: 0.85em !important;
        flex: 0 0 auto !important;
        min-width: 95px !important;
        max-width: 150px !important;
        text-align: center !important;
        white-space: nowrap !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        gap: 5px !important;
        border-radius: 8px !important;
        visibility: visible !important;
        opacity: 1 !important;
        cursor: pointer !important;
        touch-action: manipulation;
        -webkit-tap-highlight-color: rgba(0,0,0,0.1);
    }
    
    .nav-tab:active {
        transform: scale(0.95);
    }
    
    /* Статистические карточки в мобильной версии */
    .stats-grid {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
        margin-bottom: 12px;
        width: 100%;
    }
    
    .stat-card {
        padding: 12px 8px;
        text-align: center;
        width: 100%;
        min-width: 0;
    }
    
    .stat-card h3 {
        font-size: 1.4em;
        margin-bottom: 4px;
        word-wrap: break-word;
    }
    
    .stat-card p {
        font-size: 0.85em;
        margin: 0;
    }
    
    /* Контейнер таблицы */
    .table-container {
        margin-bottom: 12px;
        display: block;
        width: 100%;
        max-width: 100%;
        overflow: visible;
        background: white;
        border-radius: 10px;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
        position: relative;
    }
    
    /* Убеждаемся что content-area прокручивается когда редактор минимизирован */
    .content-area {
        overflow-y: visible !important;
        overflow-x: hidden;
        min-height: auto;
        padding-bottom: 20px;
        -webkit-overflow-scrolling: touch;
        position: relative;
        height: auto;
        max-height: none;
    }
    
    /* Dashboard должен позволять прокрутку */
    .dashboard {
        overflow-y: visible !important;
        overflow-x: hidden;
        height: auto !important;
        max-height: none !important;
        min-height: auto;
        position: relative;
    }
    
    /* Контейнер с редактором не должен блокировать прокрутку когда минимизирован */
    #luckysheet-container:not(.fullscreen-mode) {
        position: relative;
        margin-bottom: 20px;
        height: auto;
        max-height: none;
    }
    
    
    /* Убеждаемся что все элементы видны */
    .dashboard > * {
        position: relative;
        z-index: 1;
    }
    
    .dashboard .stats-grid {
        position: relative;
        z-index: 1;
    }
    
    .dashboard .nav-tabs {
        position: relative;
        z-index: 1;
    }
    
    .dashboard .content-area {
        position: relative;
        z-index: 1;
    }
    
    .table-header {
        padding: 10px;
        flex-direction: column;
        gap: 8px;
        align-items: stretch;
    }
    
    .table-header h3 {
        font-size: 0.95em;
        margin: 0;
        line-height: 1.3;
    }
    
    .table-actions {
        width: 100%;
        display: flex;
        justify-content: flex-start;
        flex-wrap: wrap;
        gap: 6px;
    }
    
    .table-actions .btn-small {
        padding: 8px 10px;
        font-size: 0.8em;
        flex: 0 0 auto;
        min-width: 90px;
        white-space: nowrap;
    }
    
    /* Прокрутка для таблицы */
    .table-content {
        display: block;
        overflow-x: auto !important;
        overflow-y: visible;
        width: 100%;
        max-width: 100%;
        -webkit-overflow-scrolling: touch;
        padding-bottom: 10px;
    }
    
    .data-table {
        font-size: 0.8em;
        width: 100%;
        min-width: 650px;
        table-layout: auto;
        border-collapse: separate;
        border-spacing: 0;
        display: table;
    }
    
    .data-table th,
    .data-table td {
        padding: 8px 6px;
        word-wrap: break-word;
        white-space: nowrap;
        display: table-cell;
        vertical-align: middle;
    }
    
    /* Компактные колонки */
    .data-table th:nth-child(1),
    .data-table td:nth-child(1) {
        min-width: 90px;
        max-width: 130px;
    }
    
    .data-table th:nth-child(2),
    .data-table td:nth-child(2) {
        min-width: 90px;
        max-width: 150px;
    }
    
    .data-table th:nth-child(3),
    .data-table td:nth-child(3) {
        min-width: 80px;
        max-width: 120px;
    }
    
    .data-table th:nth-child(4),
    .data-table td:nth-child(4) {
        min-width: 60px;
        max-width: 90px;
    }
    
    /* Колонка действий - sticky справа */
    .data-table th:nth-child(5),
    .data-table td:nth-child(5) {
        min-width: 240px !important;
        max-width: 300px !important;
        white-space: nowrap !important;
        position: sticky !important;
        right: 0 !important;
        background: white !important;
        z-index: 10 !important;
        box-shadow: -2px 0 6px rgba(0,0,0,0.15) !important;
        padding: 8px 4px !important;
    }
    
    .data-table tbody tr {
        background: white;
    }
    
    .data-table tbody tr:nth-child(even) {
        background: #fafbfc;
    }
    
    .data-table tbody tr:nth-child(even) td:nth-child(5) {
        background: #fafbfc !important;
    }
    
    /* Компактные кнопки */
    .data-table td:nth-child(5) .btn-small {
        font-size: 0.7em !important;
        padding: 6px 10px !important;
        margin: 2px !important;
        min-width: 65px !important;
        width: auto !important;
        max-width: none !important;
        white-space: nowrap !important;
        display: inline-block !important;
        flex: none !important;
        touch-action: manipulation;
        -webkit-tap-highlight-color: rgba(0,0,0,0.1);
    }
    
    .data-table .btn-small:active {
        transform: scale(0.95);
        opacity: 0.8;
    }
    
    /* Специальные стили для мобильной таблицы пользователей (только для таблицы пользователей) */
    #usersTable .data-table th:nth-child(1), 
    #usersTable .data-table td:nth-child(1) { width: 50px; } /* Аватар */
    #usersTable .data-table th:nth-child(2), 
    #usersTable .data-table td:nth-child(2) { width: 80px; } /* Логин */
    #usersTable .data-table th:nth-child(3), 
    #usersTable .data-table td:nth-child(3) { width: 120px; } /* ФИО */
    #usersTable .data-table th:nth-child(4), 
    #usersTable .data-table td:nth-child(4) { width: 100px; } /* Должность */
    #usersTable .data-table th:nth-child(5), 
    #usersTable .data-table td:nth-child(5) { width: 80px; } /* Отдел */
    #usersTable .data-table th:nth-child(6), 
    #usersTable .data-table td:nth-child(6) { width: 80px; } /* Роль */
    #usersTable .data-table th:nth-child(7), 
    #usersTable .data-table td:nth-child(7) { width: 60px; } /* Статус */
    #usersTable .data-table th:nth-child(8), 
    #usersTable .data-table td:nth-child(8) { width: 100px; } /* Последний вход */
    #usersTable .data-table th:nth-child(9), 
    #usersTable .data-table td:nth-child(9) { width: 60px; } /* Попытки входа */
    #usersTable .data-table th:nth-child(10), 
    #usersTable .data-table td:nth-child(10) { width: 80px; } /* Создан */
    #usersTable .data-table th:nth-child(11), 
    #usersTable .data-table td:nth-child(11) { width: 150px; } /* Действия */
    
    /* Кнопки действий в мобильной версии для пользователей */
    #usersTable .data-table .btn-small {
        font-size: 0.7em;
        padding: 3px 6px;
        margin: 1px;
        min-width: 60px;
    }
    
    /* Бейджи в мобильной версии */
    .role-badge, .status-badge {
        font-size: 0.7em;
        padding: 3px 6px;
        min-width: 60px;
    }
    
    .form-row {
        flex-direction: column;
        gap: 0;
    }
    
    .checkbox-group {
        gap: 8px;
    }
    
    .checkbox-group input[type="checkbox"] {
        width: 16px;
        height: 16px;
    }
    
    .checkbox-group label {
        font-size: 0.9em;
    }
    
    .modal-content {
        margin: 5% auto;
        padding: 15px;
        width: 95%;
        max-height: 90vh;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    /* Улучшения для открытого документа */
    .sheet-header {
        padding: 10px;
        background: white;
        border-radius: 8px;
        margin-bottom: 10px;
        display: flex;
        flex-direction: column;
        gap: 8px;
        position: sticky;
        top: 0;
        z-index: 100;
        box-shadow: 0 2px 8px rgba(0,0,0,0.1);
        width: 100%;
    }
    
    .sheet-header h2 {
        font-size: 1em;
        margin: 0;
        width: 100%;
        order: 1;
        line-height: 1.3;
    }
    
    .sheet-header button {
        padding: 8px 12px;
        font-size: 0.85em;
        width: 100%;
        min-width: auto;
    }
    
    .sheet-header .btn-secondary {
        order: 2;
        margin-bottom: 5px;
    }
    
    .sheet-actions {
        display: flex;
        flex-direction: column;
        gap: 6px;
        float: none !important;
        order: 3;
        width: 100%;
        justify-content: stretch;
    }
    
    .sheet-actions button {
        width: 100%;
    }
    
    #luckysheet-container {
        width: 100% !important;
        height: calc(100vh - 180px) !important;
        min-height: 650px !important;
        max-height: calc(100vh - 180px) !important;
        overflow: hidden !important;
        display: flex !important;
        flex-direction: column !important;
        position: relative;
        -webkit-overflow-scrolling: touch;
        border: 1px solid #ddd;
        border-radius: 8px;
        background: white;
    }
    
    /* Wrapper редактора */
    #luckysheet-container .se-wrapper {
        display: flex !important;
        flex-direction: column !important;
        height: 100% !important;
        width: 100% !important;
        overflow: hidden !important;
        gap: 0 !important;
    }
    
    /* Toolbar - очень компактный на мобильных */
    #luckysheet-container .se-toolbar {
        flex-shrink: 0 !important;
        overflow-x: auto !important;
        overflow-y: hidden !important;
        max-height: 45px !important;
        padding: 3px !important;
        min-height: 40px !important;
    }
    
    /* Formula bar - компактный на мобильных */
    #luckysheet-container .se-formula-bar {
        flex-shrink: 0 !important;
        overflow: hidden !important;
        max-height: 28px !important;
        padding: 1px 3px !important;
        min-height: 26px !important;
    }
    
    #luckysheet-container .se-formula-input {
        font-size: 10px !important;
        padding: 3px 5px !important;
        height: 24px !important;
    }
    
    #luckysheet-container .se-formula-label {
        padding: 3px 6px !important;
        font-size: 9px !important;
        min-width: 50px !important;
        height: 24px !important;
        line-height: 18px !important;
    }
    
    /* Status - минимальная высота, почти скрыт */
    #luckysheet-container .se-status {
        flex-shrink: 0 !important;
        max-height: 14px !important;
        padding: 1px 4px !important;
        font-size: 8px !important;
        line-height: 1.1 !important;
        overflow: hidden !important;
        opacity: 0.6;
        min-height: 12px !important;
    }
    
    /* Grid - занимает максимум места для видимости таблицы (20+ строк) */
    #luckysheet-container .se-grid {
        flex: 1 1 0 !important;
        overflow: auto !important;
        min-height: 580px !important;
        width: 100% !important;
        position: relative !important;
        -webkit-overflow-scrolling: touch !important;
        display: block !important;
        height: auto !important;
        max-height: none !important;
    }
    
    /* Scroll container внутри grid - заполняет весь grid */
    #luckysheet-container .se-scroll-container {
        width: 100% !important;
        height: 100% !important;
        min-height: 580px !important;
        overflow: auto !important;
        position: relative !important;
        -webkit-overflow-scrolling: touch !important;
        display: block !important;
    }
    
    /* Убеждаемся что scroll container заполняет grid */
    #luckysheet-container .se-grid:has(.se-scroll-container) {
        display: flex !important;
        flex-direction: column !important;
    }
    
    #luckysheet-container .se-grid .se-scroll-container {
        flex: 1 1 auto !important;
        min-height: 580px !important;
    }
    
    /* Таблица внутри scroll container */
    #luckysheet-container .se-table {
        width: 100% !important;
        min-width: 620px !important;
        display: table !important;
    }
    
    /* Компактные строки на мобильных для большей видимости */
    #luckysheet-container .se-table th,
    #luckysheet-container .se-table td {
        height: 20px !important;
        min-height: 20px !important;
        max-height: 20px !important;
        line-height: 18px !important;
        padding: 1px 2px !important;
        font-size: 11px !important;
    }
    
    #luckysheet-container .se-table thead th {
        height: 22px !important;
        min-height: 22px !important;
        padding-bottom: 2px !important;
    }
    
    #luckysheet-container .se-cell {
        height: 100% !important;
        padding: 1px 3px !important;
        font-size: 11px !important;
        line-height: 18px !important;
    }
    
    /* Кнопка развернуть на весь экран */
    #fullscreenToggleBtn {
        background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
        color: white;
        border: none;
        padding: 12px 20px;
        border-radius: 8px;
        font-size: 0.9em;
        font-weight: 600;
        cursor: pointer;
        transition: all 0.3s ease;
        box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
    }
    
    #fullscreenToggleBtn:active {
        transform: scale(0.95);
    }
    
    /* Fullscreen overlay */
    .fullscreen-overlay {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        width: 100%;
        height: 100%;
        z-index: 10000;
        background: white;
        display: flex;
        flex-direction: column;
        overflow: hidden;
    }
    
    .fullscreen-header {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        height: 60px;
        background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
        display: flex;
        align-items: center;
        padding: 10px 15px;
        z-index: 10001;
        box-shadow: 0 2px 8px rgba(0,0,0,0.2);
        color: white;
    }
    
    .fullscreen-header h2 {
        color: white !important;
        margin: 0;
    }
    
    #fullscreenCloseBtn {
        background: rgba(255, 255, 255, 0.2);
        color: white;
        border: 2px solid rgba(255, 255, 255, 0.3);
    }
    
    #fullscreenCloseBtn:active {
        background: rgba(255, 255, 255, 0.3);
        transform: scale(0.95);
    }
    
    /* Стили для контейнера в fullscreen режиме */
    .fullscreen-overlay #luckysheet-container {
        width: 100% !important;
        height: calc(100vh - 60px) !important;
        min-height: calc(100vh - 60px) !important;
        max-height: calc(100vh - 60px) !important;
        border: none !important;
        border-radius: 0 !important;
        overflow: hidden !important;
        position: absolute !important;
        top: 60px !important;
        left: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
        display: block !important;
        background: white !important;
    }
    
    .fullscreen-overlay #luckysheet-container .se-wrapper {
        height: 100% !important;
        display: flex !important;
        flex-direction: column !important;
    }
    
    .fullscreen-overlay #luckysheet-container .se-wrapper {
        height: 100% !important;
        display: flex !important;
        flex-direction: column !important;
        overflow: hidden !important;
    }
    
    .fullscreen-overlay #luckysheet-container .se-toolbar {
        flex-shrink: 0 !important;
        max-height: 45px !important;
        overflow-x: auto !important;
        padding: 3px !important;
    }
    
    .fullscreen-overlay #luckysheet-container .se-formula-bar {
        flex-shrink: 0 !important;
        max-height: 28px !important;
        padding: 1px 3px !important;
    }
    
    .fullscreen-overlay #luckysheet-container .se-status {
        flex-shrink: 0 !important;
        max-height: 14px !important;
        padding: 1px 4px !important;
        font-size: 8px !important;
        opacity: 0.6;
    }
    
    .fullscreen-overlay #luckysheet-container .se-grid {
        flex: 1 1 0 !important;
        overflow: auto !important;
        min-height: calc(100vh - 110px) !important;
        width: 100% !important;
        display: block !important;
    }
    
    .fullscreen-overlay #luckysheet-container .se-grid:has(.se-scroll-container) {
        display: flex !important;
        flex-direction: column !important;
    }
    
    .fullscreen-overlay #luckysheet-container .se-scroll-container {
        width: 100% !important;
        height: 100% !important;
        flex: 1 1 auto !important;
        overflow: auto !important;
        -webkit-overflow-scrolling: touch !important;
        min-height: calc(100vh - 110px) !important;
        display: block !important;
    }
    
    .fullscreen-overlay #luckysheet-container .se-table {
        display: table !important;
        width: 100% !important;
        min-width: 620px !important;
    }
    
    /* Select элементы и dropdown должны быть поверх fullscreen overlay */
    .fullscreen-overlay select,
    .fullscreen-overlay .se-cell-dropdown,
    .fullscreen-overlay .dropdown-cell-input {
        z-index: 10001 !important;
        position: relative !important;
    }
    
    /* Ячейки с select должны быть поверх других элементов */
    .fullscreen-overlay td[data-has-dropdown="true"],
    .fullscreen-overlay td .se-cell-dropdown,
    .fullscreen-overlay td .dropdown-cell-input {
        z-index: 10001 !important;
        position: relative !important;
    }
    
    /* Context menu и модальные окна поверх fullscreen */
    .fullscreen-overlay .context-menu,
    .fullscreen-overlay .modal,
    .fullscreen-overlay .modal-content,
    .fullscreen-overlay .column-sort-modal,
    .fullscreen-overlay .column-filter-modal,
    .fullscreen-overlay .filter-sort-modal,
    .fullscreen-overlay .sort-modal,
    .fullscreen-overlay .filter-settings-panel {
        z-index: 10003 !important;
        position: fixed !important;
    }
    
    /* Модальные окна фильтров и сортировки на мобильных */
    .column-filter-modal,
    .column-sort-modal,
    .filter-sort-modal,
    .sort-modal {
        z-index: 10002 !important;
        position: fixed !important;
    }
    
    /* Модальные окна в fullscreen на мобильных */
    @media (max-width: 768px) {
        .fullscreen-overlay .column-filter-modal,
        .fullscreen-overlay .column-sort-modal,
        .fullscreen-overlay .filter-sort-modal,
        .fullscreen-overlay .sort-modal {
            z-index: 10003 !important;
            position: fixed !important;
            top: 0 !important;
            left: 0 !important;
            width: 100% !important;
            height: 100% !important;
            display: flex !important;
            align-items: center !important;
            justify-content: center !important;
            padding: 10px !important;
        }
        
        .fullscreen-overlay .column-filter-modal .modal-content,
        .fullscreen-overlay .column-sort-modal .modal-content,
        .fullscreen-overlay .filter-sort-modal .modal-content,
        .fullscreen-overlay .sort-modal .modal-content {
            max-width: 95% !important;
            width: 95% !important;
            max-height: 90vh !important;
            margin: auto !important;
            display: block !important;
            overflow-y: auto !important;
            -webkit-overflow-scrolling: touch !important;
        }
        
        /* Убеждаемся что модальные окна видны на мобильных даже вне fullscreen */
        .column-filter-modal,
        .column-sort-modal,
        .filter-sort-modal,
        .sort-modal {
            z-index: 10002 !important;
        }
        
        .column-filter-modal .modal-content,
        .column-sort-modal .modal-content,
        .filter-sort-modal .modal-content,
        .sort-modal .modal-content {
            max-width: 95% !important;
            width: 95% !important;
            max-height: 85vh !important;
        }
    }
    
    /* Select опции (options в dropdown) должны быть видимы */
    .fullscreen-overlay select option {
        z-index: 10001 !important;
    }
    
    /* Убеждаемся что таблица в fullscreen имеет правильный stacking context */
    .fullscreen-overlay .se-table {
        position: relative;
        z-index: 1;
    }
    
    /* Ячейки таблицы с select - выше */
    .fullscreen-overlay .se-table td {
        position: relative;
        z-index: auto;
    }
    
    .fullscreen-overlay .se-table td:has(select),
    .fullscreen-overlay .se-table td[data-has-dropdown="true"] {
        z-index: 10001 !important;
    }
    
    /* Улучшение видимости верхней части таблицы */
    .se-table thead {
        position: sticky;
        top: 0;
        z-index: 20;
        background: #f8f9fa;
    }
    
    .se-table thead th {
        background: #f8f9fa !important;
        box-shadow: 0 2px 4px rgba(0,0,0,0.1) !important;
        position: sticky;
        top: 0;
        z-index: 21;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 3px;
    }
    
    .logo-image {
        max-width: 60px;
        max-height: 60px;
        margin-bottom: 8px;
    }
    
    .logo h1 {
        font-size: 1.6em;
    }
    
    .logo p {
        font-size: 0.85em;
    }
    
    .website-link {
        margin-top: 12px;
        padding-top: 10px;
    }
    
    .website-link a {
        font-size: 0.7em;
        padding: 5px 8px;
    }
    
    .website-text {
        font-size: 0.75em;
    }
    
    .login-form {
        padding: 20px 12px;
        margin: 3px;
        border-radius: 12px;
    }
    
    .dashboard {
        padding: 6px;
        border-radius: 12px;
    }
    
    .header {
        margin-bottom: 10px;
        padding: 8px;
    }
    
    .header-logo img {
        width: 28px;
        height: 28px;
    }
    
    .header h1 {
        font-size: 1.1em;
    }
    
    .user-info {
        padding: 10px;
        max-width: 100%;
    }
    
    .nav-tabs {
        margin-bottom: 10px;
        gap: 4px;
        padding: 3px 0;
    }
    
    .nav-tab {
        padding: 8px 12px;
        font-size: 0.75em;
        min-width: 85px;
    }
    
    /* Статистические карточки для очень маленьких экранов */
    .stats-grid {
        grid-template-columns: 1fr;
        gap: 6px;
        margin-bottom: 10px;
    }
    
    .stat-card {
        padding: 10px;
    }
    
    .stat-card h3 {
        font-size: 1.2em;
        margin-bottom: 3px;
    }
    
    .stat-card p {
        font-size: 0.75em;
    }
    
    .table-header {
        padding: 8px;
    }
    
    .table-header h3 {
        font-size: 0.9em;
    }
    
    .table-actions .btn-small {
        padding: 6px 8px;
        font-size: 0.75em;
        min-width: 80px;
    }
    
    .data-table {
        font-size: 0.75em;
        min-width: 600px;
    }
    
    .data-table th,
    .data-table td {
        padding: 6px 4px;
    }
    
    /* Компактные кнопки для списка листов */
    .data-table td:nth-child(5) .btn-small {
        font-size: 0.65em !important;
        padding: 4px 6px !important;
        margin: 2px !important;
        min-width: 55px !important;
    }
    
    /* Колонка действий */
    .data-table th:nth-child(5),
    .data-table td:nth-child(5) {
        min-width: 200px !important;
        max-width: 250px !important;
    }
    
    /* Компактные колонки */
    .data-table th:nth-child(1),
    .data-table td:nth-child(1) {
        min-width: 80px;
        max-width: 120px;
    }
    
    .data-table th:nth-child(2),
    .data-table td:nth-child(2) {
        min-width: 80px;
        max-width: 140px;
    }
    
    .data-table th:nth-child(3),
    .data-table td:nth-child(3) {
        min-width: 70px;
        max-width: 110px;
    }
    
    .data-table th:nth-child(4),
    .data-table td:nth-child(4) {
        min-width: 60px;
        max-width: 85px;
    }
    
    /* Специальные стили для таблицы пользователей */
    #usersTable .data-table th:nth-child(1), 
    #usersTable .data-table td:nth-child(1) { width: 40px; }
    #usersTable .data-table th:nth-child(2), 
    #usersTable .data-table td:nth-child(2) { width: 70px; }
    #usersTable .data-table th:nth-child(3), 
    #usersTable .data-table td:nth-child(3) { width: 100px; }
    #usersTable .data-table th:nth-child(4), 
    #usersTable .data-table td:nth-child(4) { width: 80px; }
    #usersTable .data-table th:nth-child(5), 
    #usersTable .data-table td:nth-child(5) { width: 70px; }
    #usersTable .data-table th:nth-child(6), 
    #usersTable .data-table td:nth-child(6) { width: 70px; }
    #usersTable .data-table th:nth-child(7), 
    #usersTable .data-table td:nth-child(7) { width: 50px; }
    #usersTable .data-table th:nth-child(8), 
    #usersTable .data-table td:nth-child(8) { width: 80px; }
    #usersTable .data-table th:nth-child(9), 
    #usersTable .data-table td:nth-child(9) { width: 50px; }
    #usersTable .data-table th:nth-child(10), 
    #usersTable .data-table td:nth-child(10) { width: 70px; }
    #usersTable .data-table th:nth-child(11), 
    #usersTable .data-table td:nth-child(11) { width: 120px; }
    
    #usersTable .data-table .btn-small {
        font-size: 0.6em;
        padding: 3px 5px;
        margin: 1px;
        min-width: 45px;
    }
    
    .role-badge, .status-badge {
        font-size: 0.6em;
        padding: 2px 4px;
        min-width: 45px;
    }
    
    .modal-content {
        margin: 1% auto;
        padding: 8px;
        width: 98%;
        max-height: 96vh;
        -webkit-overflow-scrolling: touch;
    }
    
    /* Дополнительные улучшения для открытого документа */
    .sheet-header {
        padding: 6px;
        gap: 6px;
    }
    
    .sheet-header h2 {
        font-size: 0.95em;
    }
    
    .sheet-header button {
        padding: 6px 8px;
        font-size: 0.8em;
    }
    
    #luckysheet-container {
        height: calc(100vh - 170px) !important;
        min-height: 600px !important;
    }
    
    #luckysheet-container .se-toolbar {
        max-height: 38px !important;
        padding: 2px !important;
        min-height: 35px !important;
    }
    
    #luckysheet-container .se-formula-bar {
        max-height: 24px !important;
        padding: 1px 2px !important;
        min-height: 22px !important;
    }
    
    #luckysheet-container .se-status {
        max-height: 12px !important;
        padding: 1px 3px !important;
        font-size: 7px !important;
        min-height: 10px !important;
    }
    
    #luckysheet-container .se-grid {
        min-height: 540px !important;
        overflow: auto !important;
    }
    
    #luckysheet-container .se-scroll-container {
        min-height: 540px !important;
        overflow: auto !important;
    }
    
    /* Компактные строки на очень маленьких экранах */
    #luckysheet-container .se-table th,
    #luckysheet-container .se-table td {
        height: 19px !important;
        font-size: 10px !important;
    }
    
    #luckysheet-container .se-cell {
        font-size: 10px !important;
        padding: 1px 2px !important;
    }
    
    /* Убеждаемся что таблица видна и прокручивается */
    #luckysheet-container .se-table {
        display: table !important;
        width: 100% !important;
        min-width: 620px !important;
    }
    
    #luckysheet-container .se-table tbody {
        display: table-row-group !important;
    }
    
    #luckysheet-container .se-table tr {
        display: table-row !important;
    }
    
    #fullscreenToggleBtn {
        padding: 10px 16px;
        font-size: 0.85em;
    }
    
    .fullscreen-header {
        height: 50px;
        padding: 8px 12px;
    }
    
    .fullscreen-header h2 {
        font-size: 0.95em;
    }
    
    .fullscreen-overlay #luckysheet-container {
        height: calc(100vh - 50px) !important;
        top: 50px !important;
    }
}

/* Анимации загрузки */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Индикатор статуса */
.status-indicator {
    display: inline-block;
    padding: 6px 12px;
    border-radius: 15px;
    font-size: 0.9em;
    font-weight: 600;
    margin: 15px 0 0 0;
}

.status-indicator.success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.status-indicator.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.status-indicator.warning {
    background: #fff3cd;
    color: #856404;
    border: 1px solid #ffeaa7;
}

.status-indicator.loading {
    background: #cce7ff;
    color: #0056b3;
    border: 1px solid #b3d9ff;
}

/* Индикатор загрузки */
#loadingIndicator {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 30px;
    text-align: center;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
    z-index: 1000;
    display: none;
}

#loadingIndicator.show {
    display: block;
    animation: fadeIn 0.3s ease-out;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px auto;
}

#loadingIndicator p {
    color: #666;
    font-size: 1.1em;
    margin: 0 0 15px 0;
}

    /* Дополнительные стили для улучшения внешнего вида */
.content-area {
    flex: 1;
    overflow: visible;
    min-height: auto;
    padding: 0;
    background: transparent;
    -webkit-overflow-scrolling: touch;
    display: block;
    width: 100%;
}

@media (max-width: 768px) {
    .content-area {
        overflow: visible;
        width: 100%;
        max-width: 100%;
        display: block;
    }
}

/* Статистические карточки */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: white;
    border-radius: 15px;
    padding: 20px;
    text-align: center;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-5px);
}

.stat-card h3 {
    font-size: 2em;
    color: #667eea;
    margin-bottom: 10px;
    font-weight: 700;
}

.stat-card p {
    color: #666;
    font-size: 1em;
    margin: 0;
}

.sheet-container {
    flex: 1;
    overflow: auto;
    min-height: 0;
    padding: 20px;
}

/* Стили для импорта Excel */
.import-info {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 20px;
}

.import-info p {
    margin: 5px 0;
    color: #666;
}

.file-upload-area {
    border: 2px dashed #667eea;
    border-radius: 12px;
    padding: 40px 20px;
    text-align: center;
    background: #f8f9ff;
    transition: all 0.3s ease;
    cursor: pointer;
}

.file-upload-area:hover,
.file-upload-area.drag-over {
    border-color: #5a67d8;
    background: #e6f3ff;
    transform: translateY(-2px);
}

.upload-icon {
    font-size: 3em;
    margin-bottom: 15px;
    color: #667eea;
}

.file-info {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 20px;
    background: white;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
}

.file-icon {
    font-size: 2em;
    color: #28a745;
}

.file-details h4 {
    margin: 0 0 5px 0;
    color: #333;
}

.file-details p {
    margin: 2px 0;
    color: #666;
    font-size: 0.9em;
}

.import-progress {
    margin: 20px 0;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: #e0e0e0;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 10px;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #667eea, #764ba2);
    width: 0%;
    transition: width 0.3s ease;
    border-radius: 4px;
}

.import-result {
    text-align: center;
    padding: 20px;
}

.result-icon {
    font-size: 3em;
    margin-bottom: 15px;
}

.result-icon.success {
    color: #28a745;
}

.result-icon.error {
    color: #dc3545;
}

#importedSheets {
    margin-top: 20px;
    text-align: left;
}

#importedSheets h4 {
    color: #333;
    margin-bottom: 10px;
}

#importedSheets ul {
    list-style: none;
    padding: 0;
}

#importedSheets li {
    padding: 5px 0;
    color: #666;
}

.table-actions {
    display: flex;
    gap: 10px;
    align-items: center;
}

/* Стили для управления базой данных */
.database-info {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 20px;
}

.database-info h4 {
    margin-top: 0;
    color: #333;
}

.database-info p {
    margin: 5px 0;
    color: #666;
}

.database-actions {
    margin-bottom: 20px;
}

.database-actions h4 {
    color: #333;
    margin-bottom: 15px;
}

.action-buttons {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 10px;
}

.database-backup {
    background: #e7f3ff;
    border: 1px solid #b3d9ff;
    border-radius: 8px;
    padding: 15px;
}

.database-backup h4 {
    margin-top: 0;
    color: #0066cc;
}

.backup-info p {
    margin: 5px 0;
    color: #666;
}

.database-details {
    margin-top: 20px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
}

.database-details h4 {
    margin-top: 0;
    color: #333;
}

.database-details p {
    margin: 5px 0;
    color: #666;
}

/* Анимации для сообщений */
@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOut {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

/* Дополнительные улучшения адаптивности */
@media (max-width: 1200px) {
    .table-actions {
        gap: 8px;
    }
    
    .btn-small {
        min-width: 100px;
        font-size: 0.85em;
        padding: 8px 12px;
    }
    
    .data-table {
        font-size: 0.9em;
    }
    
    .data-table th,
    .data-table td {
        padding: 8px 6px;
    }
    
    .modal-content {
        width: 95%;
        margin: 2% auto;
    }
}

@media (max-width: 992px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
    }
    
    .stat-card {
        padding: 15px;
    }
    
    .stat-card h3 {
        font-size: 1.8em;
    }
    
    .table-header {
        flex-direction: column;
        align-items: stretch;
    }
    
    .table-actions {
        justify-content: center;
        margin-top: 10px;
    }
}

@media (max-width: 576px) {
    .container {
        padding: 5px;
    }
    
    .login-form {
        padding: 20px 10px;
        margin: 5px;
    }
    
    .dashboard {
        padding: 10px;
    }
    
    .header h1 {
        font-size: 1.2em;
    }
    
    .nav-tabs {
        flex-direction: column;
        gap: 5px;
    }
    
    .nav-tab {
        width: 100%;
        text-align: center;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }
    
    .table-actions {
        flex-direction: column;
        gap: 5px;
    }
    
    .btn-small {
        width: 100%;
        min-width: auto;
        font-size: 0.8em;
        padding: 10px;
    }
    
    .data-table {
        font-size: 0.8em;
    }
    
    .data-table th,
    .data-table td {
        padding: 6px 4px;
    }
    
    .modal-content {
        width: 98%;
        margin: 1% auto;
        padding: 10px;
    }
    
    .file-upload-area {
        padding: 20px 10px;
    }
    
    .upload-icon {
        font-size: 2em;
    }
}

/* Улучшения для очень маленьких экранов */
@media (max-width: 400px) {
    .container {
        padding: 2px;
    }
    
    .login-form {
        padding: 15px 8px;
        margin: 2px;
    }
    
    .dashboard {
        padding: 8px;
    }
    
    .header h1 {
        font-size: 1em;
    }
    
    .nav-tab {
        padding: 8px 10px;
        font-size: 0.8em;
    }
    
    .btn-small {
        font-size: 0.75em;
        padding: 8px;
    }
    
    .data-table {
        font-size: 0.75em;
    }
    
    .data-table th,
    .data-table td {
        padding: 4px 2px;
    }
    
    .role-badge,
    .status-badge {
        font-size: 0.7em;
        padding: 2px 4px;
        min-width: 40px;
    }
    
    .checkbox-group {
        gap: 6px;
    }
    
    .checkbox-group input[type="checkbox"] {
        width: 14px;
        height: 14px;
    }
    
    .checkbox-group label {
        font-size: 0.85em;
    }
}

/* Стили для Excel редактора */
.excel-editor {
    display: flex;
    flex-direction: column;
    height: 100%;
    background: white;
    border-radius: 8px;
    overflow: hidden;
}

.excel-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    padding: 15px;
    background: #f8f9fa;
    border-bottom: 1px solid #dee2e6;
    align-items: center;
}

.toolbar-section {
    display: flex;
    gap: 8px;
    align-items: center;
}

.toolbar-section .form-control {
    padding: 6px 10px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    font-size: 0.9em;
    min-width: 80px;
}

.toolbar-section input[type="color"] {
    width: 40px;
    height: 32px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    cursor: pointer;
}

.btn-outline {
    background: white;
    border: 1px solid #ced4da;
    color: #495057;
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9em;
    min-width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-outline:hover {
    background: #e9ecef;
}

.excel-grid-container {
    flex: 1;
    overflow: auto;
    position: relative;
}

.excel-grid {
    display: inline-block;
    border: 1px solid #dee2e6;
    background: white;
    min-width: 100%;
}

.excel-header-row {
    display: flex;
    position: sticky;
    top: 0;
    z-index: 10;
    background: #f8f9fa;
}

.excel-row {
    display: flex;
}

.excel-header-cell {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 0.8em;
    color: #495057;
    user-select: none;
}

.excel-corner {
    width: 40px;
    height: 30px;
    background: #e9ecef;
}

.excel-col-header {
    width: 80px;
    height: 30px;
}

.excel-row-header {
    width: 40px;
    height: 30px;
}

.excel-cell {
    width: 80px;
    height: 30px;
    border: 1px solid #e0e0e0;
    display: flex;
    align-items: center;
    padding: 0 4px;
    cursor: cell;
    font-size: 0.9em;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    position: relative;
}

.excel-cell:hover {
    background: #f0f8ff;
}

.excel-cell.selected {
    border: 2px solid #007bff;
    background: #e3f2fd;
}

.excel-cell-input {
    width: 100%;
    height: 100%;
    border: none;
    outline: none;
    background: transparent;
    font: inherit;
    color: inherit;
    text-align: inherit;
    padding: 0 4px;
}

.excel-status-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 15px;
    background: #f8f9fa;
    border-top: 1px solid #dee2e6;
    font-size: 0.9em;
    color: #495057;
}

/* Адаптивность для Excel редактора */
@media (max-width: 768px) {
    .excel-toolbar {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }
    
    .toolbar-section {
        justify-content: center;
        flex-wrap: wrap;
    }
    
    .toolbar-section .form-control {
        min-width: 60px;
        font-size: 0.8em;
    }
    
    .excel-cell {
        width: 60px;
        height: 25px;
        font-size: 0.8em;
    }
    
    .excel-col-header {
        width: 60px;
    }
    
    .excel-header-cell {
        font-size: 0.7em;
    }
}

@media (max-width: 480px) {
    .excel-toolbar {
        padding: 10px;
    }
    
    .toolbar-section {
        gap: 4px;
    }
    
    .toolbar-section .form-control {
        min-width: 50px;
        font-size: 0.75em;
        padding: 4px 6px;
    }
    
    .btn-outline {
        min-width: 28px;
        height: 28px;
        font-size: 0.8em;
    }
    
    .excel-cell {
        width: 50px;
        height: 22px;
        font-size: 0.75em;
    }
    
    .excel-col-header {
        width: 50px;
    }
    
    .excel-corner,
    .excel-row-header {
        width: 30px;
    }
}

/* Улучшенные стили для кнопок */
.btn-small {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 80px;
    margin: 2px;
    display: inline-block;
}

/* Стили для кнопок действий в таблице */
.data-table .btn-small {
    font-size: 0.8em;
    padding: 4px 8px;
    margin: 1px;
    min-width: 70px;
}

/* Стили для подсказок ролей */
.role-tooltip {
    position: absolute;
    background: #333;
    color: white;
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 13px;
    max-width: 350px;
    z-index: 1000;
    box-shadow: 0 6px 20px rgba(0,0,0,0.4);
    pointer-events: none;
    line-height: 1.4;
    word-wrap: break-word;
}

.role-tooltip::before {
    content: '';
    position: absolute;
    top: 100%;
    left: 20px;
    border: 6px solid transparent;
    border-top-color: #333;
}

/* Стили для бейджей ролей и статусов */
.role-badge, .status-badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 0.75em;
    font-weight: 600;
    text-align: center;
    min-width: 80px;
}

.role-badge.admin {
    background: #dc3545;
    color: white;
}



.role-badge.employee {
    background: #28a745;
    color: white;
}

.role-badge.viewer {
    background: #6c757d;
    color: white;
}

.status-badge.active {
    background: #d4edda;
    color: #155724;
}

.status-badge.inactive {
    background: #f8d7da;
    color: #721c24;
}

/* Улучшенные стили для таблиц */
.data-table {
    table-layout: auto;
}

.data-table th {
    white-space: nowrap;
    position: sticky;
    top: 0;
    z-index: 10;
    background: #f8f9fa;
}

.data-table td {
    word-wrap: break-word;
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Специальные стили для таблицы пользователей */
.data-table th:nth-child(1), .data-table td:nth-child(1) { width: 60px; } /* Аватар */
.data-table th:nth-child(2), .data-table td:nth-child(2) { width: 100px; } /* Логин */
.data-table th:nth-child(3), .data-table td:nth-child(3) { width: 150px; } /* ФИО */
.data-table th:nth-child(4), .data-table td:nth-child(4) { width: 120px; } /* Должность */
.data-table th:nth-child(5), .data-table td:nth-child(5) { width: 100px; } /* Отдел */
.data-table th:nth-child(6), .data-table td:nth-child(6) { width: 100px; } /* Роль */
.data-table th:nth-child(7), .data-table td:nth-child(7) { width: 80px; } /* Статус */
.data-table th:nth-child(8), .data-table td:nth-child(8) { width: 120px; } /* Последний вход */
.data-table th:nth-child(9), .data-table td:nth-child(9) { width: 80px; } /* Попытки входа */
.data-table th:nth-child(10), .data-table td:nth-child(10) { width: 100px; } /* Создан */
.data-table th:nth-child(11), .data-table td:nth-child(11) { width: 200px; } /* Действия */

/* Улучшенные стили для модальных окон */
.modal-content {
    border-radius: 15px;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.25);
}

/* Уведомления */
.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    background: #28a745;
    color: white;
    padding: 15px 20px;
    border-radius: 10px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    z-index: 1001;
    animation: slideInRight 0.3s ease-out;
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(100px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.notification.error {
    background: #dc3545;
}

.notification.warning {
    background: #ffc107;
    color: #333;
}

/* Excel-подобные функции */
.cell-editable {
    background: transparent;
    border: none;
    padding: 8px;
    width: 100%;
    font-size: inherit;
    font-family: inherit;
}

.cell-editable:focus {
    background: #fff3cd;
    outline: 2px solid #ffc107;
    border-radius: 4px;
}

.formula-bar {
    background: #f8f9fa;
    padding: 10px 15px;
    border-bottom: 1px solid #e1e5e9;
    display: flex;
    align-items: center;
    gap: 10px;
}

.formula-input {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid #e1e5e9;
    border-radius: 6px;
    font-family: 'Courier New', monospace;
}

/* Статистика */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: white;
    padding: 20px;
    border-radius: 15px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    text-align: center;
    transition: transform 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-5px);
}

.stat-number {
    font-size: 2em;
    font-weight: 700;
    color: #667eea;
    margin-bottom: 5px;
}

    .stat-label {
        color: #666;
        font-weight: 600;
    }
    
    /* Стили для истории изменений */
    .history-report {
        background: white;
        padding: 20px;
        border-radius: 15px;
        box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
        margin-bottom: 20px;
    }
    
    .history-report h2 {
        color: #667eea;
        margin-bottom: 20px;
        border-bottom: 2px solid #e1e5e9;
        padding-bottom: 10px;
    }
    
    .history-report h3 {
        color: #333;
        margin: 20px 0 10px 0;
    }
    
    .report-period {
        background: #f8f9fa;
        padding: 10px 15px;
        border-radius: 8px;
        margin-bottom: 20px;
        border-left: 4px solid #667eea;
    }
    
    .report-summary ul,
    .report-stats ul {
        list-style: none;
        padding: 0;
    }
    
    .report-summary li,
    .report-stats li {
        background: #f8f9fa;
        padding: 8px 12px;
        margin: 5px 0;
        border-radius: 6px;
        border-left: 3px solid #667eea;
    }
    
    .timeline {
        max-height: 400px;
        overflow-y: auto;
        border: 1px solid #e1e5e9;
        border-radius: 8px;
        padding: 15px;
    }
    
    .timeline-item {
        display: flex;
        align-items: center;
        padding: 10px 0;
        border-bottom: 1px solid #f0f0f0;
    }
    
    .timeline-item:last-child {
        border-bottom: none;
    }
    
    .timeline-time {
        min-width: 150px;
        font-size: 0.9em;
        color: #666;
        font-weight: 600;
    }
    
    .timeline-user {
        min-width: 120px;
        color: #667eea;
        font-weight: 600;
    }
    
    .timeline-action {
        flex: 1;
        color: #333;
    }
    
    /* Стили для кнопок истории */
    .history-controls {
        display: flex;
        gap: 10px;
        margin-bottom: 20px;
        flex-wrap: wrap;
    }
    
    .history-controls .btn-small {
        display: flex;
        align-items: center;
        gap: 5px;
    }
    
    /* Стили для модального окна истории */
    .history-modal .modal-content {
        max-width: 900px;
        max-height: 90vh;
    }
    
    .history-filters {
        background: #f8f9fa;
        padding: 15px;
        border-radius: 8px;
        margin-bottom: 20px;
    }
    
    .history-filters .form-row {
        margin-bottom: 10px;
    }
    
    .history-filters .form-row:last-child {
        margin-bottom: 0;
    }
    
    /* Стили для экспорта */
    .export-controls {
        display: flex;
        gap: 10px;
        margin-bottom: 20px;
        flex-wrap: wrap;
    }
    
    .export-controls .btn-small {
        display: flex;
        align-items: center;
        gap: 5px;
    }
    
    /* Анимации для истории */
    .timeline-item {
        animation: slideInLeft 0.3s ease-out;
    }
    
    @keyframes slideInLeft {
        from {
            opacity: 0;
            transform: translateX(-20px);
        }
        to {
            opacity: 1;
            transform: translateX(0);
        }
    }
    
    /* Стили для статистики */
    .stats-detail {
        background: white;
        padding: 20px;
        border-radius: 15px;
        box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
        margin-bottom: 20px;
    }
    
    .stats-detail h3 {
        color: #667eea;
        margin-bottom: 15px;
    }
    
    .stats-grid-detail {
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
        gap: 15px;
    }
    
    .stat-item {
        background: #f8f9fa;
        padding: 15px;
        border-radius: 10px;
        text-align: center;
        border-left: 4px solid #667eea;
    }
    
    .stat-item .stat-value {
        font-size: 1.5em;
        font-weight: 700;
        color: #667eea;
        margin-bottom: 5px;
    }
    
    .stat-item .stat-label {
        color: #666;
        font-size: 0.9em;
    }
    
    /* Стили для поиска */
    .search-container {
        position: relative;
        margin-bottom: 20px;
    }
    
    .search-results {
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: white;
        border: 1px solid #e1e5e9;
        border-top: none;
        border-radius: 0 0 8px 8px;
        max-height: 200px;
        overflow-y: auto;
        z-index: 100;
        display: none;
    }
    
    .search-result-item {
        padding: 10px 15px;
        cursor: pointer;
        border-bottom: 1px solid #f0f0f0;
    }
    
    .search-result-item:hover {
        background: #f8f9fa;
    }
    
    .search-result-item:last-child {
        border-bottom: none;
    }
    
    /* Стили для уведомлений */
    .notification-container {
        position: fixed;
        top: 20px;
        right: 20px;
        z-index: 1001;
    }
    
    .notification-item {
        background: #28a745;
        color: white;
        padding: 15px 20px;
        border-radius: 10px;
        box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
        margin-bottom: 10px;
        animation: slideInRight 0.3s ease-out;
        display: flex;
        align-items: center;
        gap: 10px;
        min-width: 300px;
    }
    
    .notification-item.error {
        background: #dc3545;
    }
    
    .notification-item.warning {
        background: #ffc107;
        color: #333;
    }
    
    .notification-item.info {
        background: #17a2b8;
    }
    
    .notification-close {
        background: none;
        border: none;
        color: inherit;
        font-size: 1.2em;
        cursor: pointer;
        padding: 0;
        margin-left: auto;
    }
    
    .notification-close:hover {
        opacity: 0.7;
    }

/* Стили для индикатора автосохранения */
.auto-save-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: rgba(40, 167, 69, 0.1);
    border: 1px solid rgba(40, 167, 69, 0.3);
    border-radius: 20px;
    font-size: 0.85em;
    color: #28a745;
    margin-left: 15px;
    transition: all 0.3s ease;
}

.auto-save-indicator:hover {
    background: rgba(40, 167, 69, 0.15);
    border-color: rgba(40, 167, 69, 0.5);
}

.auto-save-icon {
    font-size: 1em;
    animation: pulse 2s infinite;
}

.auto-save-text {
    font-weight: 500;
    white-space: nowrap;
}

.auto-save-status {
    font-weight: 600;
    font-size: 0.8em;
    padding: 2px 6px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.8);
    min-width: 60px;
    text-align: center;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

/* Адаптивность для индикатора автосохранения */
@media (max-width: 768px) {
    .auto-save-indicator {
        font-size: 0.8em;
        padding: 6px 10px;
        margin-left: 10px;
    }
    
    .auto-save-text {
        display: none;
    }
    
    .auto-save-status {
        font-size: 0.75em;
        min-width: 50px;
    }
}

@media (max-width: 480px) {
    .auto-save-indicator {
        font-size: 0.75em;
        padding: 4px 8px;
        margin-left: 5px;
    }
    
    .auto-save-status {
        font-size: 0.7em;
        min-width: 40px;
    }
}

.excel-workspace-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.excel-workspace-header h3 {
    margin: 0;
    font-size: 1.5em;
}

.excel-actions {
    display: flex;
    gap: 10px;
}

.excel-toolbar {
    background: #f8f9fa;
    border-bottom: 1px solid #e9ecef;
    padding: 15px 20px;
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    align-items: center;
}

.toolbar-section {
    display: flex;
    align-items: center;
    gap: 10px;
}

.toolbar-section h4 {
    margin: 0;
    font-size: 0.9em;
    color: #495057;
    min-width: 80px;
}

.toolbar-group {
    display: flex;
    gap: 5px;
    align-items: center;
}

.format-btn, .color-btn, .align-btn, .border-btn, .action-btn {
    background: white;
    border: 1px solid #dee2e6;
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.9em;
}

.format-btn:hover, .color-btn:hover, .align-btn:hover, .border-btn:hover, .action-btn:hover {
    background: #e9ecef;
    border-color: #adb5bd;
}

.format-btn.active {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

.format-select {
    padding: 8px 12px;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    background: white;
    font-size: 0.9em;
}

.color-input {
    width: 30px;
    height: 30px;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    cursor: pointer;
}

.excel-container {
    overflow: auto;
    max-height: 70vh;
}

.excel-table-header {
    display: flex;
    background: #f8f9fa;
    border-bottom: 1px solid #dee2e6;
    position: sticky;
    top: 0;
    z-index: 10;
}

.column-header {
    min-width: 80px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #e9ecef;
    border-right: 1px solid #dee2e6;
    font-weight: 600;
    font-size: 0.8em;
    color: #495057;
}

.excel-body {
    background: white;
}

.excel-row {
    display: flex;
    border-bottom: 1px solid #e9ecef;
}

.row-header {
    min-width: 50px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #e9ecef;
    border-right: 1px solid #dee2e6;
    font-weight: 600;
    font-size: 0.8em;
    color: #495057;
    position: sticky;
    left: 0;
    z-index: 5;
}

.cell {
    min-width: 80px;
    height: 30px;
    border-right: 1px solid #e9ecef;
    border-bottom: 1px solid #e9ecef;
    padding: 4px 8px;
    display: flex;
    align-items: center;
    cursor: cell;
    position: relative;
    background: white;
    transition: all 0.2s ease;
}

.cell:hover {
    background: #f8f9fa;
}

.cell.selected {
    background: #e3f2fd !important;
    border: 2px solid #2196f3 !important;
    z-index: 1;
}

.cell-input {
    width: 100%;
    height: 100%;
    border: none;
    outline: none;
    background: transparent;
    font-family: inherit;
    font-size: inherit;
    padding: 0;
}

.formula-cell {
    color: #1976d2;
    font-style: italic;
}

/* Стили для управления пользователями */
.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 0.9em;
}

.role-badge {
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 0.8em;
    font-weight: 600;
    text-transform: uppercase;
}

.role-admin {
    background: #dc3545;
    color: white;
}



.role-employee {
    background: #28a745;
    color: white;
}

.role-viewer {
    background: #6c757d;
    color: white;
}

.status-badge {
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 0.8em;
    font-weight: 600;
}

.status-badge.active {
    background: #d4edda;
    color: #155724;
}

.status-badge.inactive {
    background: #f8d7da;
    color: #721c24;
}

.action-buttons {
    display: flex;
    gap: 5px;
    flex-wrap: wrap;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin-bottom: 15px;
}

.form-group {
    display: flex;
    flex-direction: column;
}

.form-group label {
    margin-bottom: 5px;
    font-weight: 600;
    color: #495057;
}

.form-group input,
.form-group select,
.form-group textarea {
    padding: 10px 12px;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    font-size: 0.9em;
    transition: border-color 0.2s ease;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* Дополнительные стили для управления пользователями */
.attempts-badge {
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 0.8em;
    font-weight: 600;
}

.attempts-badge.success {
    background: #d4edda;
    color: #155724;
}

.attempts-badge.warning {
    background: #fff3cd;
    color: #856404;
}

.attempts-badge.danger {
    background: #f8d7da;
    color: #721c24;
}

.btn-secondary {
    background: linear-gradient(135deg, #6c757d 0%, #5a6268 100%);
    color: white;
}

.btn-secondary:hover {
    background: linear-gradient(135deg, #5a6268 0%, #495057 100%);
}

/* Специальные стили для кнопки "Назначить" */
.assign-btn {
    display: inline-block !important;
    visibility: visible !important;
    opacity: 1 !important;
    background: linear-gradient(135deg, #6c757d 0%, #5a6268 100%) !important;
    color: white !important;
    border: 1px solid #5a6268 !important;
    padding: 6px 12px !important;
    margin: 2px !important;
    border-radius: 4px !important;
    font-size: 12px !important;
    cursor: pointer !important;
    z-index: 10 !important;
    position: relative !important;
    min-width: 80px !important;
    white-space: nowrap !important;
    overflow: visible !important;
    text-overflow: unset !important;
}

.assign-btn:hover {
    background: linear-gradient(135deg, #5a6268 0%, #495057 100%) !important;
    border-color: #495057 !important;
}

/* Стили для ячеек с действиями в таблицах */
.data-table td:last-child {
    white-space: nowrap !important;
    min-width: 300px !important;
    overflow: visible !important;
}

.data-table th:last-child {
    min-width: 300px !important;
}

/* Стили для подсказок ролей */
.role-tooltip {
    position: fixed !important;
    background: #333 !important;
    color: white !important;
    padding: 15px !important;
    border-radius: 8px !important;
    font-size: 14px !important;
    max-width: 400px !important;
    z-index: 10000 !important;
    box-shadow: 0 8px 16px rgba(0,0,0,0.5) !important;
    pointer-events: none !important;
    line-height: 1.4 !important;
    word-wrap: break-word !important;
    opacity: 1 !important;
    visibility: visible !important;
    display: block !important;
}

.role-tooltip::before {
    content: '';
    position: absolute;
    top: 100%;
    left: 20px;
    border: 8px solid transparent;
    border-top-color: #333;
}

/* Стили для модальных окон */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(5px);
}

.modal-content {
    background-color: white;
    margin: 5% auto;
    border-radius: 15px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    animation: modalSlideIn 0.3s ease-out;
}

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

.modal-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px;
    border-radius: 15px 15px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    margin: 0;
    font-size: 1.5em;
}

.close {
    color: white;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    transition: opacity 0.3s ease;
}

.close:hover {
    opacity: 0.7;
}

/* Стили для таблиц */
.data-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
    background: white;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.data-table th {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 15px 10px;
    text-align: left;
    font-weight: 600;
    font-size: 0.9em;
}

.data-table td {
    padding: 12px 10px;
    border-bottom: 1px solid #e9ecef;
    vertical-align: middle;
}

.data-table tr:hover {
    background-color: #f8f9fa;
}

.data-table tr:last-child td {
    border-bottom: none;
}

/* Дополнительные стили для Luckysheet Excel редактора */

/* Контейнер для Luckysheet */
#luckysheet-container {
    width: 100% !important;
    height: 100% !important;
    min-height: 500px !important;
    border: 2px solid #ddd !important;
    border-radius: 8px !important;
    background: white !important;
    position: relative !important;
    overflow: hidden !important;
}

/* Стили для выделения ячеек в Luckysheet */
.luckysheet-cell {
    position: relative !important;
    cursor: cell !important;
    transition: all 0.2s ease !important;
    contain: layout style !important;
    will-change: background-color, border-color !important;
}

.luckysheet-cell:hover {
    background-color: #f0f8ff !important;
    outline: 1px solid #007bff !important;
}

.luckysheet-cell.selected {
    background-color: #e3f2fd !important;
    border: 2px solid #2196f3 !important;
    box-shadow: 0 0 0 1px #2196f3 !important;
    z-index: 2 !important;
}

.luckysheet-cell.editing {
    background-color: #fff3cd !important;
    outline: 2px solid #ffc107 !important;
    border-radius: 4px !important;
    z-index: 3 !important;
}

/* Стили для панели инструментов Google Sheets */
.gs-toolbar {
    background: #ffffff !important;
    border-bottom: 1px solid #dadce0 !important;
    padding: 8px 12px !important;
    display: flex !important;
    align-items: center !important;
    gap: 4px !important;
    flex-wrap: wrap !important;
    box-shadow: 0 1px 2px rgba(60,64,67,.3), 0 2px 6px 2px rgba(60,64,67,.15) !important;
}

.gs-toolbar-btn {
    background: transparent !important;
    border: 1px solid transparent !important;
    border-radius: 4px !important;
    padding: 6px 8px !important;
    margin: 0 1px !important;
    cursor: pointer !important;
    transition: all 0.15s ease !important;
    min-width: 32px !important;
    height: 32px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-size: 13px !important;
    color: #5f6368 !important;
    user-select: none !important;
}

.gs-toolbar-btn:hover {
    background: #f1f3f4 !important;
    border-color: #dadce0 !important;
}

.gs-toolbar-btn:active {
    background: #e8eaed !important;
}

.gs-toolbar-btn.active {
    background: #e8f0fe !important;
    color: #1a73e8 !important;
}

.gs-menu-btn {
    background: #f8f9fa !important;
    border: 1px solid #dadce0 !important;
    border-radius: 20px !important;
    padding: 4px 12px !important;
    font-size: 14px !important;
}

.gs-filter-btn.active {
    background: #e8f0fe !important;
    color: #1a73e8 !important;
    border-color: #1a73e8 !important;
}

.gs-toolbar-separator {
    width: 1px !important;
    height: 24px !important;
    background: #dadce0 !important;
    margin: 0 4px !important;
    display: inline-block !important;
}

.gs-toolbar-select {
    background: #ffffff !important;
    border: 1px solid #dadce0 !important;
    border-radius: 4px !important;
    padding: 4px 8px !important;
    height: 32px !important;
    font-size: 13px !important;
    color: #202124 !important;
    cursor: pointer !important;
    transition: all 0.15s ease !important;
    min-width: 80px !important;
}

.gs-toolbar-select:hover {
    border-color: #c1c8d0 !important;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1) !important;
}

.gs-toolbar-select:focus {
    outline: none !important;
    border-color: #1a73e8 !important;
    box-shadow: 0 0 0 2px rgba(26,115,232,0.2) !important;
}

.gs-font-family {
    min-width: 120px !important;
    font-family: inherit !important;
}

.gs-toolbar-input-group {
    display: inline-flex !important;
    align-items: center !important;
    border: 1px solid #dadce0 !important;
    border-radius: 4px !important;
    height: 32px !important;
    overflow: hidden !important;
}

.gs-toolbar-btn-small {
    background: transparent !important;
    border: none !important;
    padding: 4px 6px !important;
    cursor: pointer !important;
    height: 32px !important;
    min-width: 24px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    color: #5f6368 !important;
    font-size: 14px !important;
}

.gs-toolbar-btn-small:hover {
    background: #f1f3f4 !important;
}

.gs-toolbar-input-small {
    border: none !important;
    padding: 4px 6px !important;
    width: 32px !important;
    height: 32px !important;
    text-align: center !important;
    font-size: 13px !important;
    color: #202124 !important;
    background: transparent !important;
}

.gs-toolbar-color-btn {
    width: 32px !important;
    height: 32px !important;
    border: 1px solid transparent !important;
    border-radius: 4px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    cursor: pointer !important;
    transition: all 0.15s ease !important;
    color: #5f6368 !important;
    font-size: 14px !important;
    user-select: none !important;
}

.gs-toolbar-color-btn:hover {
    background: #f1f3f4 !important;
    border-color: #dadce0 !important;
}

/* Стили для кнопок функций */
.gs-toolbar-btn[data-function] {
    min-width: 50px !important;
    font-size: 12px !important;
    font-weight: 500 !important;
}

.gs-toolbar-btn[data-function]:hover {
    background: #e8f0fe !important;
    border-color: #1a73e8 !important;
    color: #1a73e8 !important;
}

/* Стили для панели инструментов Luckysheet (старые - для обратной совместимости) */
.luckysheet-toolbar {
    background: #f8f9fa !important;
    border-bottom: 2px solid #dee2e6 !important;
    padding: 8px !important;
}

.luckysheet-toolbar-button {
    background: white !important;
    border: 1px solid #ced4da !important;
    border-radius: 4px !important;
    padding: 6px 12px !important;
    margin: 0 2px !important;
    cursor: pointer !important;
    transition: all 0.2s ease !important;
    min-width: 32px !important;
    height: 32px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
}

.luckysheet-toolbar-button:hover {
    background: #e9ecef !important;
    border-color: #adb5bd !important;
}

.luckysheet-toolbar-button.active {
    background: #007bff !important;
    color: white !important;
    border-color: #007bff !important;
}

/* Стили для формул */
.luckysheet-formula {
    background: #f8f9fa !important;
    border: 1px solid #dee2e6 !important;
    border-radius: 4px !important;
    padding: 8px 12px !important;
    font-family: 'Courier New', monospace !important;
    font-size: 14px !important;
}

/* Стили для строки состояния */
.luckysheet-statusbar {
    background: #f8f9fa !important;
    border-top: 1px solid #dee2e6 !important;
    padding: 4px 12px !important;
    font-size: 12px !important;
    color: #6c757d !important;
}

/* Стили для объединенных ячеек */
.se-cell.merged {
  border: 2px solid #0078d4 !important;
  background-color: #f0f8ff !important;
  font-weight: bold !important;
  text-align: center !important;
}

.se-table td[rowspan],
.se-table td[colspan] {
  border: 2px solid #0078d4 !important;
  background-color: #f0f8ff !important;
  font-weight: bold !important;
  text-align: center !important;
}

.se-table td[rowspan] .se-cell,
.se-table td[colspan] .se-cell {
  border: none !important;
  background-color: transparent !important;
  font-weight: bold !important;
  text-align: center !important;
}
.luckysheet-merged-cell {
    background: #e3f2fd !important;
    border: 2px solid #2196f3 !important;
    text-align: center !important;
    vertical-align: middle !important;
    font-weight: bold !important;
}

/* Стили для замороженных областей */
.luckysheet-frozen-row {
    background: #fff3cd !important;
    position: sticky !important;
    top: 0 !important;
    z-index: 10 !important;
}

.luckysheet-frozen-column {
    background: #fff3cd !important;
    position: sticky !important;
    left: 0 !important;
    z-index: 10 !important;
}

/* Стили для прокрутки таблицы */
.se-scroll-container {
    overflow: auto !important;
    scrollbar-width: thin;
    scrollbar-color: #888 #f1f1f1;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.se-scroll-container::-webkit-scrollbar {
    width: 12px;
    height: 12px;
}

.se-scroll-container::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 6px;
}

.se-scroll-container::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 6px;
    border: 2px solid #f1f1f1;
}

.se-scroll-container::-webkit-scrollbar-thumb:hover {
    background: #555;
}

.se-scroll-container::-webkit-scrollbar-corner {
    background: #f1f1f1;
}

/* Стили для таблицы внутри контейнера прокрутки */

.se-table {
    min-width: 100%;
    table-layout: fixed;
    border-collapse: separate;
    border-spacing: 0;
}

.se-table th,
.se-table td {
    min-width: 80px;
    width: 80px;
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    padding: 8px;
    border: 1px solid #ddd;
    background: white;
}

/* Стили для редактируемых ячеек */
.se-cell[contenteditable="true"] {
    white-space: pre-wrap;
    word-wrap: break-word;
    overflow-wrap: break-word;
    min-height: 20px;
}

.se-cell.editing {
    background: #fff3cd;
    border: 2px solid #ffc107;
    border-radius: 4px;
    z-index: 100;
    position: relative;
}

.se-table th {
    background: #f8f9fa;
    font-weight: bold;
    position: sticky;
    top: 0;
    z-index: 10;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.se-table th:first-child {
    position: sticky;
    left: 0;
    z-index: 11;
    background: #e9ecef;
    box-shadow: 2px 0 4px rgba(0,0,0,0.1);
}

.se-table th:first-child[style*="top"] {
    z-index: 12;
    background: #e9ecef;
}

/* Стили для комментариев */
.luckysheet-comment {
    background: #ffc107 !important;
    color: #212529 !important;
    border-radius: 50% !important;
    width: 16px !important;
    height: 16px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-size: 10px !important;
    font-weight: bold !important;
    position: absolute !important;
    top: -8px !important;
    right: -8px !important;
    z-index: 5 !important;
}

/* Стили для фильтров */
.luckysheet-filter {
    background: #28a745 !important;
    color: white !important;
    border-radius: 3px !important;
    padding: 2px 6px !important;
    font-size: 10px !important;
    font-weight: bold !important;
}

/* Стили для условного форматирования */
.luckysheet-conditional-format {
    position: relative !important;
}

.luckysheet-conditional-format::before {
    content: '' !important;
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    border-radius: 3px !important;
    z-index: -1 !important;
}

/* Анимации для выделения */
@keyframes cellHighlight {
    0% { background-color: #e3f2fd; }
    50% { background-color: #bbdefb; }
    100% { background-color: #e3f2fd; }
}

.luckysheet-cell-highlight {
    animation: cellHighlight 0.6s ease-in-out !important;
}

/* Стили для выделения ячеек в HTML редакторе */
.cell.selected {
    background-color: #e3f2fd !important;
    border: 2px solid #2196f3 !important;
    box-shadow: 0 0 0 1px #2196f3 !important;
    z-index: 2 !important;
    position: relative !important;
}

.cell.selected::after {
    content: '' !important;
    position: absolute !important;
    top: -2px !important;
    left: -2px !important;
    right: -2px !important;
    bottom: -2px !important;
    border: 2px solid #2196f3 !important;
    pointer-events: none !important;
    z-index: 3 !important;
}

.cell.highlight {
    background-color: #fff3cd !important;
    animation: cellHighlight 0.3s ease-in-out !important;
}

@keyframes cellHighlight {
    0% { background-color: #e3f2fd; }
    50% { background-color: #bbdefb; }
    100% { background-color: #e3f2fd; }
}

/* Стили для виртуальной сетки */
.virtual-cell {
    position: relative !important;
    transition: all 0.2s ease !important;
    contain: layout style !important;
}

.virtual-cell:hover {
    background-color: #f8f9fa !important;
    outline: 1px solid #007bff !important;
}

.virtual-cell.selected {
    background-color: #e3f2fd !important;
    border: 2px solid #2196f3 !important;
    z-index: 2 !important;
}

.virtual-cell-input {
    width: 100% !important;
    height: 100% !important;
    border: none !important;
    outline: none !important;
    background: transparent !important;
    font-size: 12px !important;
    padding: 4px !important;
}

.virtual-cell-input:focus {
    background: #fff3cd !important;
    outline: 2px solid #ffc107 !important;
    border-radius: 2px !important;
}

/* Стили для выделения диапазона ячеек */
.cell.range-selected {
    background-color: #e3f2fd !important;
    border: 1px solid #2196f3 !important;
    position: relative !important;
}

.cell.selection-preview {
    background-color: rgba(33, 150, 243, 0.2) !important;
    border: 1px dashed #2196f3 !important;
    position: relative !important;
}

.cell.selection-preview::after {
    content: '' !important;
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    border: 1px solid rgba(33, 150, 243, 0.5) !important;
    pointer-events: none !important;
}

/* Стили для курсора при выделении */
.excel-container[style*="crosshair"],
.excel-container .cell {
    cursor: crosshair !important;
}

/* Анимация для плавного выделения */
@keyframes rangeSelection {
    0% {
        background-color: #ffffff;
        border-color: #e9ecef;
    }
    50% {
        background-color: #bbdefb;
        border-color: #2196f3;
    }
    100% {
        background-color: #e3f2fd;
        border-color: #2196f3;
    }
}

.cell.range-selected {
    animation: rangeSelection 0.3s ease-in-out !important;
}

/* Стили для множественного выделения */
.cell.multi-selected {
    background-color: #fff3cd !important;
    border: 1px solid #ffc107 !important;
    position: relative !important;
}

.cell.multi-selected::before {
    content: '' !important;
    position: absolute !important;
    top: 2px !important;
    right: 2px !important;
    width: 0 !important;
    height: 0 !important;
    border-left: 6px solid transparent !important;
    border-top: 6px solid #ffc107 !important;
    z-index: 1 !important;
}

/* Стили для первой ячейки в выделенном диапазоне */
.cell.range-start {
    background-color: #2196f3 !important;
    color: white !important;
    font-weight: bold !important;
}

.cell.range-start .cell-input {
    color: white !important;
}

/* Стили для области выделения */
.selection-area {
    position: absolute !important;
    border: 2px solid #2196f3 !important;
    background: rgba(33, 150, 243, 0.1) !important;
    pointer-events: none !important;
    z-index: 100 !important;
    display: none !important;
}

/* Стили для мобильных устройств */
@media (max-width: 768px) {
    #luckysheet-container {
        height: 400px !important;
        min-height: 400px !important;
    }

    .luckysheet-toolbar {
        padding: 4px !important;
        overflow-x: auto !important;
    }

    .luckysheet-toolbar-button {
        min-width: 28px !important;
        height: 28px !important;
        padding: 4px 8px !important;
    }
}

/* Стили для темной темы */
@media (prefers-color-scheme: dark) {
    #luckysheet-container {
        background: #2d3748 !important;
        border-color: #4a5568 !important;
    }

    .luckysheet-toolbar {
        background: #2d3748 !important;
        border-color: #4a5568 !important;
    }

    .luckysheet-statusbar {
        background: #2d3748 !important;
        border-color: #4a5568 !important;
        color: #e2e8f0 !important;
    }
}

/* Стили для input box при редактировании */
.luckysheet-input-box {
    background: white !important;
    border: 2px solid #007bff !important;
    border-radius: 4px !important;
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.25) !important;
    outline: none !important;
    position: absolute !important;
    z-index: 1000 !important;
}

/* Стили для области выделения */
.luckysheet-selection {
    position: absolute !important;
    border: 2px solid #007bff !important;
    background: rgba(0, 123, 255, 0.1) !important;
    pointer-events: none !important;
    z-index: 1 !important;
}

/* Стили для кнопок форматирования */
.luckysheet-color-picker {
    border: 1px solid #ced4da !important;
    border-radius: 4px !important;
    width: 24px !important;
    height: 24px !important;
    cursor: pointer !important;
    overflow: hidden !important;
}

.luckysheet-color-picker:hover {
    border-color: #adb5bd !important;
    transform: scale(1.1) !important;
}

/* Стили для выпадающих меню */
.luckysheet-dropdown {
    background: white !important;
    border: 1px solid #dee2e6 !important;
    border-radius: 4px !important;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1) !important;
    z-index: 100 !important;
    max-height: 200px !important;
    overflow-y: auto !important;
}

.luckysheet-dropdown-item {
    padding: 8px 12px !important;
    cursor: pointer !important;
    transition: background-color 0.2s ease !important;
}

.luckysheet-dropdown-item:hover {
    background: #f8f9fa !important;
}

/* Стили для полосы прокрутки в Luckysheet */
.luckysheet-scrollbar {
    background: #f1f3f4 !important;
    border-radius: 8px !important;
}

.luckysheet-scrollbar:hover {
    background: #e8eaed !important;
}

.luckysheet-scrollbar-thumb {
    background: #dadce0 !important;
    border-radius: 8px !important;
}

.luckysheet-scrollbar-thumb:hover {
    background: #bdc1c6 !important;
}

/* Стили для страницы статистики */
.dashboard .statistics-container {
    padding: 15px;
    max-width: 100%;
    margin: 0 auto;
    background: transparent;
    box-shadow: none;
    border-radius: 0;
}

.statistics-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding: 15px;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.statistics-header h3 {
    color: #667eea;
    font-size: 1.4em;
    margin: 0;
    font-weight: 600;
}

.statistics-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

.statistics-actions .btn-small {
    padding: 6px 10px;
    font-size: 0.8em;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 4px;
}

.statistics-actions .btn-small:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.statistics-page-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
    width: 100%;
}

.statistics-card {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    transition: all 0.3s ease;
    min-height: 250px;
    display: flex;
    flex-direction: column;
}

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

.statistics-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 15px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.statistics-card-header h4 {
    margin: 0;
    font-size: 1em;
    font-weight: 600;
}

.online-indicator,
.changes-indicator {
    font-size: 1em;
    animation: pulse 2s infinite;
}

.statistics-card-content {
    padding: 15px;
    flex: 1;
    overflow-y: auto;
    max-height: 300px;
}

.online-users-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding: 10px;
    background: rgba(102, 126, 234, 0.1);
    border-radius: 8px;
}

.users-count {
    display: flex;
    align-items: center;
    gap: 8px;
}

.count-number {
    font-size: 1.2em;
    font-weight: 700;
    color: #667eea;
}

.count-label {
    font-size: 0.9em;
    color: #6c757d;
}

.users-more {
    font-size: 0.8em;
    color: #6c757d;
}

.show-all-users {
    margin-top: 15px;
    text-align: center;
    padding: 10px;
    border-top: 1px solid rgba(0, 0, 0, 0.1);
}

.show-all-users .btn-small {
    width: 100%;
    max-width: 200px;
}

.online-user-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 10px;
    border-left: 4px solid #28a745;
    transition: all 0.3s ease;
}

.online-user-item:hover {
    background: #e9ecef;
    transform: translateX(5px);
}

.user-avatar {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
    font-size: 1.2em;
    flex-shrink: 0;
}

.user-info {
    flex: 1;
    min-width: 0;
}

.user-name {
    font-weight: 600;
    color: #333;
    margin-bottom: 4px;
}

.user-role {
    font-size: 0.9em;
    color: #667eea;
    margin-bottom: 4px;
}

.user-last-seen {
    font-size: 0.8em;
    color: #6c757d;
}

.user-status {
    display: flex;
    align-items: center;
}

.status-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    animation: pulse 2s infinite;
}

.status-dot.online {
    background: #28a745;
}

.change-item {
    display: flex;
    align-items: flex-start;
    gap: 15px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 10px;
    border-left: 4px solid #667eea;
    transition: all 0.3s ease;
}

.change-item:hover {
    background: #e9ecef;
    transform: translateX(5px);
}

.change-icon {
    font-size: 1.5em;
    flex-shrink: 0;
    margin-top: 2px;
}

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

.change-description {
    font-weight: 500;
    color: #333;
    margin-bottom: 6px;
    line-height: 1.4;
}

.change-file-info {
    display: flex;
    gap: 10px;
    margin-bottom: 8px;
    font-size: 0.8em;
    color: #495057;
}

.file-name,
.sheet-name {
    background: rgba(102, 126, 234, 0.1);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.75em;
}

.change-meta {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 0.8em;
    color: #6c757d;
}

.change-user {
    font-weight: 500;
    color: #667eea;
}

.change-time {
    color: #495057;
    font-weight: 500;
}

.change-ago {
    color: #6c757d;
    font-style: italic;
}

.empty-state,
.error-state {
    text-align: center;
    padding: 40px 20px;
    color: #6c757d;
}

.empty-icon {
    font-size: 3em;
    margin-bottom: 15px;
    opacity: 0.5;
}

.error-state {
    color: #dc3545;
}

.statistics-footer {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 15px;
    padding: 20px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.statistics-info {
    text-align: center;
    color: #6c757d;
}

.statistics-info p {
    margin: 5px 0;
    font-size: 0.9em;
}

.loading {
    text-align: center;
    padding: 40px 20px;
    color: #667eea;
    font-style: italic;
}

/* Адаптивность для статистики */
@media (max-width: 768px) {
    /* Видео фон для мобильных */
    #backgroundVideo {
        opacity: 0.2;
    }
    
    .header {
        flex-direction: column;
        gap: 10px;
        padding: 10px 15px;
        margin-bottom: 15px;
    }
    
    .header h1 {
        font-size: 1.1em;
        text-align: center;
    }
    
    .user-info {
        margin-left: auto;
        margin-right: auto;
        min-width: auto;
        width: 100%;
        max-width: 300px;
        justify-content: center;
    }
    
    .dashboard .statistics-container {
        padding: 10px;
    }
    
    .statistics-header {
        flex-direction: column;
        gap: 10px;
        text-align: center;
        padding: 12px;
    }
    
    .statistics-header h3 {
        font-size: 1.2em;
    }
    
    .statistics-page-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    
    .statistics-card {
        min-height: 200px;
    }
    
    .statistics-card-content {
        padding: 12px;
        max-height: 250px;
    }
    
    .online-user-item,
    .change-item {
        flex-direction: column;
        text-align: center;
        gap: 8px;
        padding: 8px;
    }
    
    .user-info,
    .change-content {
        text-align: center;
    }
    
    .change-meta {
        justify-content: center;
    }
    
    .online-users-header {
        flex-direction: column;
        gap: 8px;
        text-align: center;
    }
    
    .users-count {
        justify-content: center;
    }
}

/* Дополнительные стили для очень маленьких экранов */
@media (max-width: 480px) {
    #backgroundVideo {
        opacity: 0.15;
    }
}

/* Стили для портретной ориентации на мобильных */
@media (max-width: 768px) and (orientation: portrait) {
    #backgroundVideo {
        opacity: 0.25;
    }
}

/* Стили для ландшафтной ориентации на мобильных */
@media (max-width: 768px) and (orientation: landscape) {
    #backgroundVideo {
        opacity: 0.2;
    }
    
    .dashboard {
        height: 100vh;
        max-height: 100vh;
    }
    
    #luckysheet-container {
        height: calc(100vh - 180px) !important;
        min-height: 300px !important;
    }
    
    .sheet-header {
        padding: 8px;
        margin-bottom: 8px;
    }
    
    .sheet-header h2 {
        font-size: 1.1em;
    }
    
    .sheet-header button {
        padding: 6px 10px;
        font-size: 0.85em;
    }
    
    .table-content {
        max-height: calc(100vh - 300px);
        overflow-x: auto !important;
        overflow-y: auto;
    }
    
    .data-table {
        min-width: 600px;
    }
}

/* Стили для средних экранов */
@media (min-width: 992px) and (max-width: 1399px) {
    .user-info {
        margin-right: 25px;
    }
}

/* Стили для больших экранов */
@media (min-width: 1400px) {
    .header-logo img {
        width: 50px;
        height: 50px;
    }
    
    .header h1 {
        font-size: 1.6em;
    }
    
    .user-info {
        min-width: 500px;
        gap: 30px;
        padding: 20px 25px;
        margin-right: 40px;
    }
    
    .user-role {
        padding: 14px 24px;
        font-size: 1.1em;
        color: white !important;
    }
    
    .user-info span:not(.user-role) {
        font-size: 1.1em;
        color: white !important;
    }
    
    .logout-btn {
        padding: 14px 24px;
        font-size: 1.1em;
        color: white !important;
    }
}

/* Стили для настроек фильтров в модальном окне редактирования листа */
.form-section {
    margin-bottom: 20px;
    padding: 15px;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    background: #f8f9fa;
}

.form-section h3 {
    margin: 0 0 15px 0;
    color: #333;
    font-size: 1.1em;
    border-bottom: 2px solid #667eea;
    padding-bottom: 8px;
}

.filter-settings-info {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
    padding: 10px;
    background: #e3f2fd;
    border-radius: 6px;
    border-left: 3px solid #2196f3;
}

.info-icon {
    font-size: 16px;
    margin-top: 1px;
}

.info-text p {
    margin: 0;
    color: #555;
    line-height: 1.3;
    font-size: 0.9em;
}

.filter-columns-container {
    max-height: 300px;
    overflow-y: auto;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    background: white;
}

.loading-indicator {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 30px;
    color: #666;
    font-size: 0.9em;
}

.spinner {
    width: 16px;
    height: 16px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-right: 8px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.filter-column-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    border-bottom: 1px solid #f0f0f0;
    transition: background 0.2s;
}

.filter-column-item:last-child {
    border-bottom: none;
}

.filter-column-item:hover {
    background: #f8f9fa;
}

.column-name {
    font-weight: 600;
    color: #333;
    font-size: 1em;
    min-width: 30px;
}

.column-controls {
    display: flex;
    gap: 15px;
}

.control-item {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    transition: background 0.2s;
}

.control-item:hover {
    background: #f0f0f0;
}

.control-item input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: #667eea;
    margin: 0;
}

.control-text {
    font-weight: 500;
    color: #333;
    font-size: 0.85em;
}

.filter-actions {
    display: flex;
    gap: 8px;
    justify-content: center;
    margin-top: 12px;
    flex-wrap: wrap;
}

.btn-small {
    padding: 4px 10px;
    font-size: 0.8em;
    border-radius: 4px;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-small.btn-outline {
    background: transparent;
    color: #667eea;
    border: 1px solid #667eea;
}

.btn-small.btn-outline:hover {
    background: #667eea;
    color: white;
}

.no-columns {
    text-align: center;
    color: #666;
    padding: 30px;
    font-style: italic;
    font-size: 0.9em;
}

.error-message {
    background: #ff6b6b;
    color: white;
    padding: 12px;
    border-radius: 8px;
    margin-top: 15px;
    text-align: center;
    display: none;
    animation: shake 0.5s ease-in-out;
    font-weight: 500;
    font-size: 0.9em;
}

/* Адаптивность для модального окна */
@media (max-width: 768px) {
    .filter-column-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .column-info {
        margin-right: 0;
        width: 100%;
    }

    .column-header {
        justify-content: space-between;
    }

    .control-group {
        align-self: flex-end;
    }

    .filter-actions {
        flex-direction: column;
    }

    .form-section {
        padding: 12px;
    }
}

/* Стили для выпадающих списков */
.dropdown-cell-input {
    position: relative;
}

.dropdown-cell-input::after {
    content: '▼';
    position: absolute;
    right: 4px;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
    color: #5f6368;
    font-size: 10px;
}

/* Dropdown в контекстном меню */
.dropdown-config-modal {
    animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

.dropdown-config-content {
    max-height: 90vh;
    overflow-y: auto;
}

.dropdown-value-item {
    transition: all 0.2s;
}

.dropdown-value-item:hover {
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.dropdown-color-input::-webkit-color-swatch-wrapper {
    padding: 0;
}

.dropdown-color-input::-webkit-color-swatch {
    border: 1px solid #ddd;
    border-radius: 4px;
}

/* Стили для опций в выпадающих списках */
.dropdown-cell-input option {
    padding: 8px 12px;
    font-size: 13px;
}

/* Индикатор выпадающего списка в ячейке */
.se-table td[data-has-dropdown="true"]::after {
    content: '▼';
    position: absolute;
    right: 4px;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
    color: #5f6368;
    font-size: 10px;
}

.se-table td[data-has-dropdown="true"] {
    position: relative;
    padding-right: 24px;
}

/* Стили для выбора уникальных значений */
.unique-value-item {
    transition: all 0.2s;
}

.unique-value-item:hover {
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    background: #f8f9fa;
}

.unique-value-item input[type="checkbox"] {
    cursor: pointer;
}

.unique-value-item label {
    user-select: none;
}

#unique-values-picker {
    animation: fadeIn 0.2s ease;
}

.unique-value-color::-webkit-color-swatch-wrapper {
    padding: 0;
}

.unique-value-color::-webkit-color-swatch {
    border: 1px solid #ddd;
    border-radius: 4px;
}