* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    height: 100%;
    margin: 0;
    padding: 0;
    overflow: hidden;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: #f5f7fa;
    color: #333;
    line-height: 1.6;
    display: flex;
    flex-direction: column;
}

/* Страница авторизации */
.login-page {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.login-container {
    width: 100%;
    max-width: 400px;
    padding: 20px;
}

.login-box {
    background: white;
    padding: 40px;
    border-radius: 10px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
}

.login-box h1 {
    margin-bottom: 30px;
    text-align: center;
    color: #333;
}

.error-message {
    background: #fee;
    color: #c33;
    padding: 10px;
    border-radius: 5px;
    margin-bottom: 20px;
    text-align: center;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
    color: #555;
}

.form-group input {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 16px;
    transition: border-color 0.3s;
}

.form-group input:focus {
    outline: none;
    border-color: #667eea;
}

.btn-primary {
    width: 100%;
    padding: 12px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 5px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.3s;
}

.btn-primary:hover {
    background: #5568d3;
}

/* Основная страница */
.container {
    max-width: 100%;
    margin: 0;
    padding: 20px;
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid #e0e0e0;
    flex-shrink: 0;
}

header h1 {
    color: #333;
    font-size: 32px;
}

.btn-logout {
    padding: 10px 20px;
    background: #dc3545;
    color: white;
    text-decoration: none;
    border-radius: 5px;
    font-weight: 500;
    transition: background 0.3s;
}

.btn-logout:hover {
    background: #c82333;
}

/* Статистика */
.stats-bar {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-bottom: 15px;
    flex-shrink: 0;
}

.stat-card {
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    text-align: center;
}

.stat-value {
    font-size: 32px;
    font-weight: bold;
    color: #667eea;
    margin-bottom: 5px;
}

.stat-label {
    color: #666;
    font-size: 14px;
}

/* Таблица */
.table-container {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
}

thead {
    background: #f8f9fa;
    display: table;
    width: 100%;
    table-layout: fixed;
}

tbody {
    display: block;
    max-height: calc(100vh - 350px);
    overflow-y: auto;
    overflow-x: hidden;
    width: 100%;
}

tbody tr {
    display: table;
    width: 100%;
    table-layout: fixed;
}


th {
    padding: 15px;
    text-align: left;
    font-weight: 600;
    color: #555;
    border-bottom: 2px solid #e0e0e0;
    white-space: nowrap;
}


td {
    padding: 15px;
    border-bottom: 1px solid #f0f0f0;
    vertical-align: middle;
}

tbody tr:hover {
    background: #f8f9fa;
}

tbody tr:last-child td {
    border-bottom: none;
}

.editable, .editable-link {
    cursor: pointer;
    padding: 5px;
    border-radius: 3px;
    transition: background 0.2s;
    display: inline-block;
}

.editable:hover, .editable-link:hover {
    background: #e3f2fd;
}

.editable a {
    color: #667eea;
    text-decoration: none;
}

.editable a:hover {
    text-decoration: underline;
}

.add-link {
    color: #999;
    font-style: italic;
}

.empty {
    color: #999;
    font-style: italic;
}

.edit-input {
    width: 100%;
    padding: 5px 8px;
    border: 1px solid #667eea;
    border-radius: 3px;
    font-size: 14px;
}

.edit-input:focus {
    outline: none;
    border-color: #5568d3;
}

/* Чекбокс статуса оплаты */
.checkbox-label {
    display: flex;
    align-items: center;
    cursor: pointer;
    gap: 8px;
}

.payment-status {
    width: 20px;
    height: 20px;
    cursor: pointer;
}

.payment-status-text {
    user-select: none;
}

/* Кнопки действий */
.btn-edit, .btn-save, .btn-delete {
    padding: 6px 12px;
    margin: 0 3px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.2s;
}

.btn-edit {
    background: #667eea;
    color: white;
}

.btn-edit:hover {
    background: #5568d3;
}

.btn-save {
    background: #28a745;
    color: white;
}

.btn-save:hover {
    background: #218838;
}

.btn-delete {
    background: #dc3545;
    color: white;
}

.btn-delete:hover {
    background: #c82333;
}

/* Секция добавления проекта */
.add-project-section {
    text-align: center;
    margin-top: 15px;
    flex-shrink: 0;
}

.btn-add {
    padding: 12px 30px;
    background: #28a745;
    color: white;
    border: none;
    border-radius: 5px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.3s;
}

.btn-add:hover {
    background: #218838;
}

/* Модальное окно */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    overflow: auto;
}

.modal-content {
    background-color: white;
    margin: 50px auto;
    padding: 30px;
    border-radius: 10px;
    width: 90%;
    max-width: 600px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.3);
    position: relative;
}

.close {
    position: absolute;
    right: 20px;
    top: 15px;
    font-size: 28px;
    font-weight: bold;
    color: #999;
    cursor: pointer;
    transition: color 0.2s;
}

.close:hover {
    color: #333;
}

.modal-content h2 {
    margin-bottom: 20px;
    color: #333;
}

.modal-content .form-group {
    margin-bottom: 15px;
}

.modal-content .form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
    color: #555;
}

.modal-content .form-group input {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 14px;
}

.modal-content .form-group input:focus {
    outline: none;
    border-color: #667eea;
}

.form-actions {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

.btn-secondary {
    padding: 10px 20px;
    background: #6c757d;
    color: white;
    border: none;
    border-radius: 5px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.3s;
}

.btn-secondary:hover {
    background: #5a6268;
}

/* Адаптивность */
@media (max-width: 1200px) {
    .table-container {
        overflow-x: auto;
    }
    
    tbody {
        overflow-x: auto;
    }
}

@media (max-width: 768px) {
    .container {
        padding: 10px;
    }
    
    header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }
    
    .stats-bar {
        grid-template-columns: 1fr;
    }
    
    .modal-content {
        margin: 20px auto;
        padding: 20px;
        width: 95%;
    }
}

