:root {
    --primary: #2d6a4f;
    --primary-dark: #1b4d3e;
    --primary-light: #74c69d;
    --secondary: #40916c;
    --gray-light: #f5f9f7;
    --gray: #e9ecef;
    --gray-dark: #6c757d;
    --text: #2d3e3a;
    --white: #ffffff;
    --error: #d32f2f;
    --shadow-sm: 0 2px 8px rgba(0,0,0,0.05);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
    --border-radius: 12px;
    --border-radius-sm: 8px;
}

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

body {
    font-family: 'Segoe UI', system-ui, sans-serif;
    background: var(--gray-light);
    color: var(--text);
}

.login-body {
    background: linear-gradient(135deg, #1b4d3e 0%, #2d6a4f 50%, #40916c 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-container { max-width: 440px; width: 90%; margin: 20px; }
.login-card {
    background: var(--white);
    border-radius: 24px;
    padding: 40px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}
.logo { text-align: center; margin-bottom: 24px; }

.form-group { margin-bottom: 20px; }
.form-group label { display: block; margin-bottom: 8px; font-weight: 500; font-size: 14px; }
.form-group input, .form-group select {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--gray);
    border-radius: var(--border-radius-sm);
    font-size: 15px;
}
.form-group input:focus {
    outline: none;
    border-color: var(--primary-light);
    box-shadow: 0 0 0 3px rgba(45,106,79,0.1);
}

.login-btn, .btn-primary {
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    border: none;
    border-radius: var(--border-radius-sm);
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}
.login-btn:hover, .btn-primary:hover { transform: translateY(-1px); box-shadow: var(--shadow-md); }

.btn-secondary {
    background: var(--gray);
    color: var(--text);
    padding: 10px 24px;
    border: none;
    border-radius: var(--border-radius-sm);
    font-weight: 600;
    cursor: pointer;
}
.btn-danger {
    background: var(--error);
    color: white;
    padding: 10px 24px;
    border: none;
    border-radius: var(--border-radius-sm);
    font-weight: 600;
    cursor: pointer;
}
.btn-danger:hover { background: #c62828; transform: translateY(-1px); }

.error-message {
    background: #ffebee;
    color: var(--error);
    padding: 12px;
    border-radius: var(--border-radius-sm);
    margin-bottom: 20px;
    border-left: 3px solid var(--error);
}
.success-message {
    background: #e8f5e9;
    color: #2e7d32;
    padding: 12px;
    border-radius: var(--border-radius-sm);
    margin-bottom: 20px;
    border-left: 3px solid #2e7d32;
}

.header {
    background: linear-gradient(135deg, var(--primary-dark), var(--primary));
    color: white;
    padding: 16px 32px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
}
.logo-area { display: flex; align-items: center; gap: 12px; }
.user-info { display: flex; align-items: center; gap: 20px; background: rgba(255,255,255,0.1); padding: 8px 16px; border-radius: 40px; }
.logout-btn {
    background: rgba(255,255,255,0.15);
    color: white;
    padding: 6px 14px;
    text-decoration: none;
    border-radius: 20px;
}
.logout-btn:hover { background: rgba(255,255,255,0.3); }

.container { display: flex; min-height: calc(100vh - 76px); }
.sidebar {
    width: 280px;
    background: var(--white);
    border-right: 1px solid var(--gray);
    padding: 24px 16px;
}
.sidebar h3 { color: var(--primary-dark); margin-bottom: 20px; padding-left: 12px; }
.sidebar ul { list-style: none; }
.sidebar li a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    color: var(--text);
    text-decoration: none;
    border-radius: 8px;
}
.sidebar li a:hover { background: rgba(45,106,79,0.08); color: var(--primary); }
.sidebar li a.active {
    background: rgba(45,106,79,0.1);
    color: var(--primary);
    border-left: 3px solid var(--primary);
}
.content { flex: 1; padding: 32px; overflow-x: auto; }

.data-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--white);
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}
.data-table th {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    padding: 14px 16px;
    text-align: left;
}
.data-table td { padding: 12px 16px; border-bottom: 1px solid var(--gray); }
.data-table tr:hover { background: rgba(45,106,79,0.03); }

.form-card {
    background: var(--white);
    border-radius: var(--border-radius);
    padding: 28px;
    box-shadow: var(--shadow-sm);
}
.form-card h3 { color: var(--primary-dark); margin-bottom: 20px; }

.welcome {
    background: var(--white);
    border-radius: var(--border-radius);
    padding: 32px;
    box-shadow: var(--shadow-sm);
}
.welcome h2 { color: var(--primary-dark); margin-bottom: 16px; }

.loading { text-align: center; padding: 40px; color: var(--gray-dark); }

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}
.modal-content {
    background: white;
    border-radius: 16px;
    max-width: 800px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
}
.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    background: linear-gradient(135deg, var(--primary-dark), var(--primary));
    color: white;
    border-radius: 16px 16px 0 0;
}
.modal-close {
    background: none;
    border: none;
    font-size: 28px;
    cursor: pointer;
    color: white;
}
.modal-body { padding: 24px; }

@media (max-width: 768px) {
    .container { flex-direction: column; }
    .sidebar { width: 100%; border-right: none; border-bottom: 1px solid var(--gray); }
    .header { flex-direction: column; gap: 12px; text-align: center; }
    .user-info { flex-wrap: wrap; justify-content: center; }
}
::placeholder {
    color: var(--gray-dark);
    opacity: 0.7;
}

input:focus::placeholder {
    opacity: 0.4;
}
/* Модальные окна - не закрываются при клике на фон */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    /* Убираем закрытие по клику на фон */
    pointer-events: none;
}

.modal-overlay .modal-content {
    pointer-events: auto;
}