/* Общие стили */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: #f4f6f9;
    color: #333;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

a {
    color: #0066cc;
    text-decoration: none;
}
a:hover {
    text-decoration: underline;
}

.container {
    width: 100%;
    min-width: 0;
    max-width: 1400px;
    margin: 0 auto;
    padding: 1.5rem;
    flex: 1;
}

/* Заголовок страницы */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 1rem;
}
.page-header h1 {
    font-size: 1.8rem;
    font-weight: 600;
}
.page-header .user-info {
    font-size: 0.95rem;
    background: #fff;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

/* Навигация */
.navbar {
    background: #fff;
    box-shadow: 0 1px 4px rgba(0,0,0,0.1);
    padding: 0.75rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}
.navbar .brand {
    font-weight: 700;
    font-size: 1.2rem;
    color: #1a2a3a;
}
.navbar .nav-links {
    display: flex;
    gap: 1.2rem;
    align-items: center;
    flex-wrap: wrap;
}
.navbar .nav-links a {
    color: #444;
    font-weight: 500;
}
.navbar .nav-links a:hover {
    color: #0066cc;
    text-decoration: none;
}
.navbar .nav-links .logout {
    color: #d32f2f;
}

/* Карточки */
.card {
    min-width: 0;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.08);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}
.card-header {
    font-weight: 600;
    font-size: 1.1rem;
    margin-bottom: 1rem;
    border-bottom: 1px solid #eee;
    padding-bottom: 0.5rem;
}

/* Таблицы */
table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.95rem;
}
th, td {
    padding: 0.6rem 0.8rem;
    text-align: left;
    border-bottom: 1px solid #e9ecef;
}
th {
    background: #f8f9fa;
    font-weight: 600;
}
tr:hover {
    background: #f8f9fa;
}

/* Формы */
.form-group {
    margin-bottom: 1rem;
}
.form-group label {
    display: block;
    font-weight: 500;
    margin-bottom: 0.3rem;
}
.form-group input, .form-group select, .form-group textarea {
    width: 100%;
    padding: 0.6rem 0.8rem;
    border: 1px solid #ced4da;
    border-radius: 4px;
    font-size: 1rem;
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
    border-color: #0066cc;
    outline: none;
    box-shadow: 0 0 0 3px rgba(0,102,204,0.15);
}
.form-row {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}
.form-row .form-group {
    flex: 1;
    min-width: 200px;
}

/* Кнопки */
.btn {
    display: inline-block;
    padding: 0.6rem 1.2rem;
    border: none;
    border-radius: 4px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s;
    text-align: center;
}
.btn-primary {
    background: #0066cc;
    color: #fff;
}
.btn-primary:hover {
    background: #0052a3;
}
.btn-success {
    background: #28a745;
    color: #fff;
}
.btn-success:hover {
    background: #1e8a3a;
}
.btn-danger {
    background: #d32f2f;
    color: #fff;
}
.btn-danger:hover {
    background: #b71c1c;
}
.btn-warning {
    background: #f0ad4e;
    color: #fff;
}
.btn-warning:hover {
    background: #d98c2e;
}
.btn-secondary {
    background: #6c757d;
    color: #fff;
}
.btn-secondary:hover {
    background: #5a6268;
}
.btn-sm {
    padding: 0.3rem 0.8rem;
    font-size: 0.85rem;
}

/* Статусы */
.status {
    padding: 0.2rem 0.6rem;
    border-radius: 12px;
    font-size: 0.85rem;
    font-weight: 500;
    display: inline-block;
}
.status-active {
    background: #d4edda;
    color: #155724;
}
.status-inactive {
    background: #f8d7da;
    color: #721c24;
}
.status-warning {
    background: #fff3cd;
    color: #856404;
}
.status-success {
    background: #d4edda;
    color: #155724;
}
.status-error {
    background: #f8d7da;
    color: #721c24;
}

/* Алerts */
.alert {
    padding: 0.8rem 1.2rem;
    border-radius: 4px;
    margin-bottom: 1rem;
    font-weight: 500;
}
.alert-success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}
.alert-error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}
.alert-warning {
    background: #fff3cd;
    color: #856404;
    border: 1px solid #ffc107;
}

/* Страница входа */
.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background: #e9ecef;
}
.login-box {
    background: #fff;
    padding: 2.5rem;
    border-radius: 10px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
    width: 100%;
    max-width: 400px;
}
.login-box h1 {
    font-size: 1.8rem;
    margin-bottom: 0.5rem;
    text-align: center;
}
.login-box h2 {
    font-size: 1.2rem;
    font-weight: 400;
    color: #555;
    text-align: center;
    margin-bottom: 1.5rem;
}
.login-box .form-group {
    margin-bottom: 1.2rem;
}
.login-box .btn {
    width: 100%;
    padding: 0.8rem;
}

/* Адаптивность */
@media (max-width: 768px) {
    .container {
        padding: 1rem;
    }
    .card {
        padding: 1rem;
    }
    .navbar {
        flex-direction: column;
        align-items: stretch;
    }
    .navbar .nav-links {
        justify-content: center;
    }
    .page-header {
        flex-direction: column;
        align-items: flex-start;
    }
    .form-row {
        flex-direction: column;
    }
    table {
        font-size: 0.85rem;
    }
    th, td {
        padding: 0.4rem 0.5rem;
    }
    .login-box {
        padding: 1.5rem;
        margin: 1rem;
    }
}

@media (max-width: 650px) {
    html, body {
        max-width: 100%;
        overflow-x: hidden;
    }
    .btn {
        min-height: 42px;
    }
    input, select, textarea {
        font-size: 16px;
    }
}

/* Графики */
.chart-container {
    position: relative;
    height: 300px;
    margin: 1rem 0;
}

/* Таблицы с прокруткой */
.table-responsive {
    overflow-x: auto;
}

/* Сводка */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(200px, 100%), 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}
.stat-card {
    background: #fff;
    padding: 1rem;
    border-radius: 8px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.08);
    text-align: center;
}
.stat-card .stat-number {
    font-size: 2rem;
    font-weight: 700;
    color: #0066cc;
}
.stat-card .stat-label {
    color: #666;
    font-size: 0.9rem;
}
