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

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

#toast-container {
    position: fixed;
    top: 24px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
}

.toast {
    min-width: 320px;
    max-width: 520px;
    padding: 14px 18px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.95);
    color: #2d3748;
    font-weight: 600;
    font-size: 0.95rem;
    box-shadow: 0 10px 30px rgba(0,0,0,0.15);
    display: flex;
    align-items: center;
    gap: 10px;
    opacity: 0;
    transform: translateY(-10px);
    animation: toastIn 0.25s ease forwards;
    pointer-events: auto;
}

.toast.toast-success { border-left: 5px solid #38a169; }
.toast.toast-error { border-left: 5px solid #e53e3e; }

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

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

.app-layout {
    display: flex;
    min-height: 100vh;
}

/* ====================== БОКОВОЕ МЕНЮ ====================== */

.sidebar {
    width: 12px;
    background: linear-gradient(180deg, #1a202c 0%, #2d3748 100%);
    color: white;
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 100;
    box-shadow: 4px 0 20px rgba(0,0,0,0.25);
    transition: width 0.25s ease;
}

.sidebar:hover {
    width: 220px;
}

.sidebar > *:not(.sidebar-tab) {
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
}

.sidebar:hover > *:not(.sidebar-tab) {
    opacity: 1;
    pointer-events: auto;
}

.sidebar-tab {
    position: absolute;
    right: -24px;
    top: 50%;
    transform: translateY(-50%);
    width: 24px;
    height: 80px;
    background: linear-gradient(180deg, #1a202c 0%, #2d3748 100%);
    border-radius: 0 12px 12px 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 0.9rem;
    box-shadow: 2px 0 12px rgba(0,0,0,0.25);
    z-index: 101;
}

.sidebar-header {
    padding: 14px 8px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    overflow: hidden;
}

.sidebar-header h1 {
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 6px;
    color: white;
    white-space: nowrap;
}

.sidebar-header h1 i {
    color: #667eea;
    font-size: 1rem;
    min-width: 16px;
    text-align: center;
}

.nav-menu {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 12px 8px;
    flex: 1;
    overflow: hidden;
}

.nav-link {
    padding: 7px 8px;
    border: none;
    background: transparent;
    color: #cbd5e0;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.3s ease;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
    overflow: hidden;
}

.nav-link:hover {
    background: rgba(255,255,255,0.08);
    color: white;
}

.nav-link.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.sidebar-footer {
    padding: 10px 8px 12px;
    border-top: 1px solid rgba(255,255,255,0.1);
    overflow: hidden;
}

.user-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(255, 255, 255, 0.08);
    padding: 6px 10px;
    border-radius: 8px;
    margin-bottom: 8px;
    flex-wrap: nowrap;
    gap: 6px;
    overflow: hidden;
}

.user-welcome {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.85rem;
    color: white;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-welcome i {
    min-width: 14px;
    text-align: center;
}

.role-badge {
    padding: 2px 6px;
    border-radius: 10px;
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    white-space: nowrap;
    flex-shrink: 0;
}

.role-admin {
    background: rgba(255, 255, 255, 0.25);
    color: white;
}

.role-user {
    background: rgba(255, 255, 255, 0.15);
    color: white;
}

.role-visitor {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

.sidebar-footer .btn-danger {
    width: 100%;
    background: #e53e3e;
    color: white;
    border: none;
    padding: 6px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    white-space: nowrap;
    font-size: 0.8rem;
}

.sidebar-footer .btn-danger:hover {
    background: #c53030;
}

/* ====================== ОСНОВНОЙ КОНТЕНТ ====================== */

.main-content {
    flex: 1;
    margin-left: 12px;
    padding: 25px;
    display: flex;
    flex-direction: column;
    gap: 25px;
    transition: margin-left 0.25s ease;
}

.main-content header {
    background: linear-gradient(135deg, #5a67d8 0%, #6b46c1 100%);
    color: white;
    padding: 25px;
    border-radius: 15px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
}

.header-top {
    display: none;
}

.main-content .stats {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
}

.main-content .page {
    background: transparent;
    box-shadow: none;
    padding: 0;
    border-radius: 0;
}



.header-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 15px;
}

header h1 {
    font-size: 1.8rem;
    display: flex;
    align-items: center;
    gap: 15px;
}

.user-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(255, 255, 255, 0.15);
    padding: 12px 20px;
    border-radius: 10px;
    backdrop-filter: blur(10px);
    gap: 15px;
}

.user-welcome {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.05rem;
}

.role-badge {
    padding: 3px 12px;
    border-radius: 15px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.role-admin {
    background: rgba(255, 255, 255, 0.25);
    color: white;
}

.role-user {
    background: rgba(255, 255, 255, 0.15);
    color: white;
}

.role-visitor {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

.stats {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.1rem;
    background: rgba(255, 255, 255, 0.15);
    padding: 12px 22px;
    border-radius: 10px;
    backdrop-filter: blur(10px);
}

.stat-item strong {
    font-size: 1.3rem;
}

.stat-item i {
    font-size: 1.4rem;
}

/* ====================== ВКЛАДКИ ====================== */

/* Главная навигация по страницам */
.nav-menu {
    display: flex;
    gap: 5px;
    background: white;
    border-radius: 12px;
    padding: 6px;
    margin-bottom: 25px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.nav-link {
    flex: 1;
    padding: 14px 20px;
    border: none;
    background: none;
    color: #999;
    font-size: 1.05rem;
    font-weight: 600;
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.3s ease;
    text-decoration: none;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.nav-link:hover {
    background: #f3f0ff;
    color: #667eea;
}

.nav-link.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

/* Страницы */
.page {
    display: none;
    animation: fadeIn 0.3s ease;
}

.page.active {
    display: block;
}

/* Карточка */
.card {
    background: white;
    padding: 35px;
    border-radius: 15px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
    margin-bottom: 25px;
}

.card h2 {
    color: #2d3748;
    margin-bottom: 25px;
    font-size: 1.6rem;
    display: flex;
    align-items: center;
    gap: 12px;
}

.card h2 i {
    color: #667eea;
}

/* Подвкладки (Список / Добавить) */
.sub-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
}

.sub-tab {
    padding: 10px 20px;
    border: none;
    background: rgba(255, 255, 255, 0.15);
    color: white;
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.3s ease;
    font-weight: 600;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.sub-tab:hover {
    background: rgba(255, 255, 255, 0.3);
}

.sub-tab.active {
    background: white;
    color: #667eea;
}

.sub-content {
    display: none;
}

.sub-content.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

/* ====================== АНАЛИТИКА ====================== */

.analytics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin-bottom: 35px;
}

.analytics-card {
    padding: 25px;
    border-radius: 14px;
    text-align: center;
    color: white;
    position: relative;
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.analytics-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
}

.analytics-primary { background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); }
.analytics-success { background: linear-gradient(135deg, #38b2ac 0%, #2f855a 100%); }
.analytics-info    { background: linear-gradient(135deg, #4299e1 0%, #2b6cb0 100%); }
.analytics-warning { background: linear-gradient(135deg, #ed8936 0%, #c05621 100%); }

.analytics-icon {
    font-size: 2rem;
    margin-bottom: 10px;
    opacity: 0.85;
}

.analytics-value {
    font-size: 2.5rem;
    font-weight: 700;
    line-height: 1.2;
}

.analytics-label {
    font-size: 0.9rem;
    opacity: 0.9;
    margin-top: 5px;
}

.analytics-sub {
    font-size: 0.8rem;
    opacity: 0.75;
    margin-top: 8px;
}

.analytics-section-title {
    color: #4a5568;
    font-size: 1.2rem;
    margin: 30px 0 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.analytics-bars {
    display: flex;
    flex-direction: column;
    gap: 25px;
}

.bar-item {
    background: #f7fafc;
    padding: 18px;
    border-radius: 10px;
}

.bar-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
    font-weight: 600;
    color: #4a5568;
    font-size: 0.95rem;
    flex-wrap: wrap;
    gap: 5px;
}

.bar-header span:first-child i {
    color: #667eea;
    margin-right: 6px;
}

.bar-track {
    height: 28px;
    background: #e2e8f0;
    border-radius: 14px;
    overflow: hidden;
    display: flex;
}

.bar-fill {
    height: 100%;
    transition: width 0.6s ease;
}

.bar-ok   { background: linear-gradient(90deg, #48bb78, #38a169); }
.bar-bad  { background: linear-gradient(90deg, #f56565, #e53e3e); }
.bar-none { background: linear-gradient(90deg, #a0aec0, #718096); }

.bar-legend {
    display: flex;
    gap: 20px;
    margin-top: 10px;
    font-size: 0.85rem;
    flex-wrap: wrap;
}

.legend-ok   { color: #38a169; }
.legend-bad  { color: #e53e3e; }
.legend-none { color: #718096; }

.analytics-chart-row {
    display: flex;
    gap: 30px;
    align-items: center;
    flex-wrap: wrap;
}

.donut-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.donut {
    width: 160px;
    height: 160px;
    border-radius: 50%;
    background: #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.donut::before {
    content: "";
    width: 120px;
    height: 120px;
    background: white;
    border-radius: 50%;
    position: absolute;
}

.donut-hole {
    position: relative;
    z-index: 1;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    line-height: 1.1;
}

.donut-hole span {
    font-size: 1.6rem;
    font-weight: 700;
    color: #2c3e50;
}

.donut-hole small {
    font-size: 0.8rem;
    color: #718096;
}

.donut-legend {
    display: flex;
    gap: 15px;
    font-size: 0.9rem;
    font-weight: 600;
}

.donut-legend i {
    font-size: 0.6rem;
    margin-right: 4px;
    vertical-align: middle;
}

.analytics-summary {
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-width: 200px;
}

.summary-row {
    display: flex;
    justify-content: space-between;
    padding: 10px 14px;
    background: #f7fafc;
    border-radius: 8px;
    font-weight: 600;
    color: #4a5568;
}

.summary-value {
    color: #2c3e50;
}

.summary-value.ok { color: #38a169; }
.summary-value.bad { color: #e53e3e; }

.tab {
    flex: 1;
    padding: 14px 20px;
    border: none;
    background: none;
    color: #999;
    font-size: 1.05rem;
    font-weight: 600;
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.3s ease;
}

.tab:hover {
    background: #f3f0ff;
    color: #667eea;
}

.tab.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

/* ====================== КОНТЕНТ ВКЛАДОК ====================== */

.tab-content {
    display: none;
    background: white;
    padding: 35px;
    border-radius: 15px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
    margin-bottom: 25px;
}

.tab-content.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

.tab-content h2 {
    color: #2d3748;
    margin-bottom: 25px;
    font-size: 1.6rem;
    display: flex;
    align-items: center;
    gap: 12px;
}

.tab-content h2 i {
    color: #667eea;
}

/* ====================== ФИЛЬТРЫ ====================== */

.controls {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
    flex-wrap: wrap;
    align-items: stretch;
}

.controls input,
.controls select {
    flex: 1 1 180px;
    padding: 11px 16px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 0.95rem;
    min-width: 0;
    transition: all 0.3s ease;
    background: #f7fafc;
}

.controls button {
    flex: 0 0 auto;
}

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

/* ====================== ТАБЛИЦЫ ====================== */

.table-container {
    overflow-x: auto;
    border-radius: 10px;
}

table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 5px;
}

table thead {
    background: linear-gradient(135deg, #5a67d8 0%, #6b46c1 100%);
    color: white;
}

table th {
    padding: 14px 16px;
    text-align: left;
    font-weight: 600;
    font-size: 0.9rem;
    white-space: nowrap;
}

table th:first-child {
    border-top-left-radius: 10px;
}

table th:last-child {
    border-top-right-radius: 10px;
}

table td {
    padding: 14px 16px;
    border-bottom: 1px solid #edf2f7;
    font-size: 0.95rem;
}

table tbody tr {
    transition: background 0.2s ease;
}

table tbody tr:hover {
    background: #f7fafc;
}

/* ====================== КНОПКИ ====================== */

.btn {
    padding: 8px 16px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 600;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 14px 30px;
    font-size: 1.05rem;
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 7px 25px rgba(102, 126, 234, 0.4);
}

.btn-danger {
    background: linear-gradient(135deg, #f56565 0%, #e53e3e 100%);
    color: white;
}

.btn-danger:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(229, 62, 62, 0.3);
}

.btn-success {
    background: linear-gradient(135deg, #48bb78 0%, #38a169 100%);
    color: white;
}

.btn-success:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(56, 161, 105, 0.3);
}

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

.btn-info:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.btn-secondary {
    background: #e2e8f0;
    color: #4a5568;
}

.btn-secondary:hover {
    background: #cbd5e0;
}

.btn-sm {
    padding: 7px 11px;
    font-size: 0.82rem;
    border-radius: 6px;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: none !important;
}

/* ====================== БЕЙДЖИ СТАТУСОВ ====================== */

.status-badge {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.82rem;
    font-weight: 600;
    display: inline-block;
}

.status-ok {
    background: #c6f6d5;
    color: #22543d;
}

.status-bad {
    background: #fed7d7;
    color: #742a2a;
}

.status-unknown {
    background: #edf2f7;
    color: #4a5568;
}

/* ====================== БЕЙДЖИ ЗАПОЛНЕННОСТИ ====================== */

.fill-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 0.72rem;
    font-weight: 700;
    margin-top: 6px;
    white-space: nowrap;
}

.fill-badge i {
    font-size: 0.68rem;
}

.fill-badge-ok {
    background: #c6f6d5;
    color: #22543d;
}

.fill-badge-bad {
    background: #fefcbf;
    color: #744210;
}

.status-operational {
    background: #c6f6d5;
    color: #22543d;
}

.status-not-operational {
    background: #fed7d7;
    color: #742a2a;
}

/* ====================== ФОРМЫ ====================== */

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
    margin-bottom: 18px;
}

.form-group {
    margin-bottom: 0;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    padding: 18px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.form-group:hover {
    transform: translateY(-1px);
    box-shadow: 0 8px 24px rgba(0,0,0,0.08);
    border-color: #cbd5e0;
}

.form-group label {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
    font-weight: 700;
    color: #2d3748;
    font-size: 0.92rem;
}

.form-group label i {
    color: #667eea;
    width: 18px;
    text-align: center;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 11px 14px;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    font-size: 0.95rem;
    background: #f7fafc;
    transition: all 0.25s ease;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23667eea' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 18px 18px;
    padding-right: 36px;
    font-family: inherit;
}

.form-group input[type="date"] {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23667eea' stroke-width='2'%3E%3Crect x='3' y='4' width='18' height='18' rx='2'/%3E%3Cpath d='M16 2v4M8 2v4M3 10h18'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 18px 18px;
}

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

.form-group select {
    cursor: pointer;
}

.form-actions {
    margin-top: 22px;
    display: flex;
    gap: 12px;
}

.section-title {
    color: #4a5568;
    font-size: 1.1rem;
    margin: 28px 0 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid #edf2f7;
    display: flex;
    align-items: center;
    gap: 10px;
}

.section-title i {
    color: #667eea;
}

.actions-cell {
    white-space: nowrap;
    display: flex;
    gap: 6px;
}

.role-select {
    padding: 7px 12px;
    border: 2px solid #e2e8f0;
    border-radius: 6px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.role-select:focus {
    outline: none;
    border-color: #667eea;
}

.role-select:disabled {
    background: #f7fafc;
    cursor: not-allowed;
    color: #a0aec0;
}

/* ====================== АЛЕРТЫ ====================== */

.alert {
    padding: 15px;
    border-radius: 10px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.alert-warning {
    background: #fef5e7;
    color: #744210;
    border: 1px solid #fbd38d;
}

.alert i {
    font-size: 1.2rem;
}

.permission-message {
    margin-bottom: 20px;
}

/* ====================== ТЕКСТОВЫЕ УТИЛИТЫ ====================== */

.text-muted {
    color: #a0aec0;
}

/* ====================== КАРТОЧКИ АВТОМОБИЛЕЙ ====================== */

.cars-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(380px, 1fr));
    gap: 18px;
}

.car-card {
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
    border: 1px solid #e2e8f0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.car-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(0,0,0,0.12);
}

.car-card-header {
    padding: 16px 18px;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    background: #f8fafc;
}

.car-card-toggle-wrap {
    padding: 8px 18px;
    background: #ffffff;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    justify-content: center;
}

.card-toggle-btn {
    border-radius: 20px;
    padding: 4px 14px;
    font-size: 0.85rem;
    font-weight: 600;
    letter-spacing: 0.2px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s ease;
}

.card-toggle-icon {
    display: inline-block;
    transition: transform 0.2s ease;
}

.card-toggle-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.car-plate {
    font-size: 1.1rem;
    font-weight: 700;
    color: #2d3748;
    letter-spacing: 0.3px;
}

.car-brand {
    font-size: 0.9rem;
    color: #718096;
    margin-top: 2px;
}

.car-actions {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
}

.car-card-body {
    padding: 14px 18px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.car-info-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 10px;
    font-size: 0.92rem;
}

.car-info-label {
    color: #718096;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 140px;
}

.car-info-value {
    color: #2d3748;
    text-align: right;
    word-break: break-word;
}

.car-card-footer {
    padding: 14px 18px;
    border-top: 1px solid #e2e8f0;
    background: #fafbfc;
}

.check-row {
    display: flex;
    gap: 10px;
    align-items: flex-end;
}

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

.check-row label {
    font-size: 0.8rem;
    font-weight: 700;
    color: #718096;
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.check-row input {
    width: 100%;
    padding: 8px 10px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 0.9rem;
    background: white;
    transition: all 0.3s ease;
}

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

small {
    font-size: 0.82rem;
}

/* ====================== ФУТЕР ====================== */

footer {
    text-align: center;
    margin-top: 40px;
    padding: 20px;
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.9rem;
}

/* ====================== МОБИЛЬНАЯ ВЕРСИЯ ====================== */

.mobile-top-bar {
    display: none;
}

/* ====================== МОДАЛЬНОЕ ОКНО ПОДТВЕРЖДЕНИЯ ====================== */

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 9998;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.2s ease;
}

.modal-box {
    background: white;
    border-radius: 14px;
    padding: 24px;
    width: 380px;
    max-width: 92vw;
    box-shadow: 0 10px 30px rgba(0,0,0,0.25);
    display: flex;
    flex-direction: column;
    gap: 14px;
    text-align: center;
}

.modal-box.type-logout {
    border-top: 4px solid #667eea;
}

.modal-icon {
    font-size: 2.5rem;
    color: #e53e3e;
}

.modal-icon.icon-logout {
    color: #667eea;
}

.modal-message {
    font-size: 1.1rem;
    font-weight: 700;
    color: #2d3748;
}

.modal-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-top: 6px;
}

.modal-actions .btn-secondary {
    background: #edf2f7;
    color: #2d3748;
}

.modal-actions .btn-secondary:hover {
    background: #e2e8f0;
}

/* --- Variant: success --- */
.modal-box.type-success {
    border-top: 4px solid #38a169;
}
.modal-icon.icon-success {
    color: #38a169;
}

/* --- Variant: danger --- */
.modal-box.type-danger {
    border-top: 4px solid #e53e3e;
}
.modal-icon.icon-danger {
    color: #e53e3e;
}

/* --- Variant: prompt --- */
.modal-box.type-prompt {
    border-top: 4px solid #667eea;
}
.modal-icon.icon-prompt {
    color: #667eea;
}

.modal-input {
    width: 100%;
    padding: 10px 12px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 0.95rem;
    outline: none;
    transition: border-color 0.2s;
    box-sizing: border-box;
}
.modal-input:focus {
    border-color: #667eea;
}

.modal-hint {
    font-size: 0.85rem;
    color: #718096;
    margin-top: -8px;
}

/* ====================== АНИМАЦИИ ====================== */

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

.fade-in {
    animation: fadeIn 0.3s ease forwards;
}

@media (max-width: 768px) {

    /* === МОБИЛЬНАЯ ВЕРХНЯЯ ПАНЕЛЬ === */
    body.mobile .mobile-top-bar {
        display: flex;
        align-items: center;
        justify-content: space-between;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        z-index: 1001;
        background: linear-gradient(180deg, #1a202c 0%, #2d3748 100%);
        padding: 8px 14px;
        padding-top: max(8px, env(safe-area-inset-top));
        box-shadow: 0 2px 12px rgba(0,0,0,0.25);
    }

    body.mobile .mobile-top-bar .sidebar-header {
        padding: 0;
        border: none;
        flex-shrink: 0;
    }

    body.mobile .mobile-top-bar .sidebar-header h1 {
        font-size: 0.95rem;
    }

    body.mobile .mobile-top-bar .sidebar-footer {
        display: flex;
        flex-direction: row;
        align-items: center;
        gap: 8px;
        padding: 0;
        border: none;
        flex-shrink: 0;
    }

    body.mobile .mobile-top-bar .user-info {
        margin: 0;
        padding: 5px 12px;
        background: rgba(255,255,255,0.12);
        border-radius: 20px;
    }

    body.mobile .mobile-top-bar .user-welcome {
        font-size: 0.8rem;
    }

    body.mobile .mobile-top-bar .role-badge {
        display: none;
    }

    body.mobile .mobile-top-bar .sidebar-footer .btn-danger {
        width: auto;
        padding: 8px 12px;
        font-size: 0;
        border-radius: 50%;
    }

    body.mobile .mobile-top-bar .sidebar-footer .btn-danger i {
        font-size: 1.05rem;
    }

    /* === SIDEBAR → НИЖНЯЯ НАВИГАЦИЯ === */
    body.mobile .app-layout {
        flex-direction: column;
    }

    body.mobile .sidebar {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        top: auto;
        width: 100%;
        height: auto;
        flex-direction: row;
        border-radius: 0;
        padding: 0;
        padding-bottom: env(safe-area-inset-bottom, 0px);
        z-index: 1000;
        box-shadow: 0 -2px 16px rgba(0,0,0,0.2);
    }

    body.mobile .sidebar > *:not(.sidebar-tab) {
        opacity: 1;
        pointer-events: auto;
    }

    body.mobile .sidebar-tab,
    body.mobile .sidebar-header,
    body.mobile .sidebar-footer {
        display: none !important;
    }

    body.mobile .nav-menu {
        flex-direction: row;
        flex: 1;
        justify-content: space-around;
        padding: 0;
        gap: 0;
        background: linear-gradient(180deg, #1a202c 0%, #2d3748 100%);
    }

    body.mobile .nav-link {
        flex: 1;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        padding: 6px 2px;
        font-size: 0.6rem;
        gap: 3px;
        border-radius: 0;
        min-height: 54px;
        white-space: nowrap;
    }

    body.mobile .nav-link i {
        font-size: 1.2rem;
    }

    body.mobile .nav-link.active {
        box-shadow: inset 0 -3px 0 #667eea;
    }

    /* === ОСНОВНОЙ КОНТЕНТ === */
    body.mobile .main-content {
        margin-left: 0;
        padding: 52px 10px 76px 10px;
        gap: 14px;
    }

    body.mobile .main-content > header {
        padding: 14px 16px;
        border-radius: 12px;
    }

    /* === СТАТИСТИКА === */
    body.mobile .stats {
        gap: 8px;
    }

    body.mobile .stat-item {
        padding: 8px 14px;
        font-size: 0.88rem;
    }

    body.mobile .stat-item strong {
        font-size: 1.1rem;
    }

    /* === КАРТОЧКИ === */
    body.mobile .card {
        padding: 14px;
        border-radius: 12px;
        margin-bottom: 14px;
    }

    body.mobile .card h2 {
        font-size: 1.1rem;
        margin-bottom: 12px;
    }

    /* === ПОДВКЛАДКИ === */
    body.mobile .sub-tabs {
        gap: 6px;
        margin-bottom: 12px;
    }

    body.mobile .sub-tab {
        padding: 9px 14px;
        font-size: 0.85rem;
    }

    /* === ФИЛЬТРЫ === */
    body.mobile .controls {
        flex-direction: column;
        gap: 8px;
    }

    body.mobile .controls input,
    body.mobile .controls select {
        width: 100%;
        flex: 1 1 100%;
        min-width: 0;
        padding: 12px 14px;
    }

    body.mobile .controls button {
        width: 100%;
        justify-content: center;
    }

    /* === ФОРМЫ === */
    body.mobile .form-row {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    body.mobile .form-group {
        padding: 14px;
    }

    body.mobile .form-group input,
    body.mobile .form-group select,
    body.mobile .form-group textarea {
        padding: 12px 14px;
        font-size: 16px;
    }

    body.mobile .form-actions {
        flex-direction: column;
    }

    body.mobile .form-actions .btn {
        width: 100%;
        justify-content: center;
        padding: 14px;
    }

    /* === ВАЛИДАТОРЫ === */
    body.mobile .validator-row {
        display: flex !important;
        flex-direction: column !important;
        gap: 8px !important;
        padding-right: 0 !important;
    }

    body.mobile .validator-row .form-group {
        width: 100%;
    }

    body.mobile .validator-row .btn-danger {
        align-self: flex-end !important;
        margin-left: 0 !important;
        width: auto !important;
    }

    body.mobile .section-title {
        font-size: 1rem;
        margin: 18px 0 12px;
    }

    /* === КАРТОЧКИ АВТОМОБИЛЕЙ === */
    body.mobile .cars-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    body.mobile .car-card-header {
        flex-direction: column;
        gap: 10px;
    }

    body.mobile .car-info-label {
        min-width: auto;
    }

    body.mobile .car-card-toggle-wrap {
        padding: 6px 12px;
    }

    body.mobile .car-card-body,
    body.mobile .car-card-footer {
        padding: 12px 14px;
    }

    /* === ЧЕК-РОУ === */
    body.mobile .check-row {
        flex-direction: column;
        gap: 8px;
    }

    /* === ТАБЛИЦЫ === */
    body.mobile .table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    body.mobile table {
        font-size: 0.8rem;
    }

    body.mobile table th,
    body.mobile table td {
        padding: 10px 8px;
    }

    /* === КНОПКИ === */
    body.mobile .btn {
        min-height: 44px;
    }

    body.mobile .btn-primary {
        padding: 14px 20px;
        font-size: 1rem;
        width: 100%;
        justify-content: center;
    }

    /* === АНАЛИТИКА === */
    body.mobile .analytics-grid {
        grid-template-columns: 1fr 1fr;
        gap: 10px;
    }

    body.mobile .analytics-card {
        padding: 14px;
    }

    body.mobile .analytics-value {
        font-size: 1.7rem;
    }

    body.mobile .analytics-chart-row {
        flex-direction: column;
        gap: 20px;
    }

    body.mobile .donut {
        width: 130px;
        height: 130px;
    }

    body.mobile .donut::before {
        width: 96px;
        height: 96px;
    }

    body.mobile .analytics-bars {
        gap: 14px;
    }

    body.mobile .bar-legend {
        gap: 12px;
    }

    /* === ФОТО ТС (СПИСОК) === */
    body.mobile .photos-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 10px;
    }

    body.mobile .photo-card-thumb {
        height: 110px;
    }

    body.mobile .photo-card-plate {
        font-size: 0.95rem;
    }

    body.mobile .photo-card-brand {
        font-size: 0.78rem;
    }

    /* === ФОТО КОНКРЕТНОГО ТС === */
    body.mobile .photo-grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
        gap: 10px;
    }

    body.mobile .photo-item img {
        height: 110px;
    }

    body.mobile .car-photo-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    body.mobile .car-photo-plate {
        font-size: 1.1rem;
    }

    body.mobile .category-header {
        flex-wrap: wrap;
        gap: 8px;
        padding: 10px 12px;
    }

    body.mobile .category-body {
        padding: 10px 12px;
    }

    /* === МОДАЛЬНЫЕ ОКНА === */
    body.mobile .modal-overlay {
        align-items: flex-end;
    }

    body.mobile .modal-box {
        width: 100%;
        max-width: 100%;
        padding: 20px 16px;
        padding-bottom: max(20px, env(safe-area-inset-bottom));
        border-radius: 16px 16px 0 0;
        animation: slideUp 0.25s ease forwards;
    }

    body.mobile .modal-actions {
        flex-direction: column-reverse;
    }

    body.mobile .modal-actions .btn {
        width: 100%;
        justify-content: center;
        min-height: 48px;
    }

    body.mobile .photo-delete-box {
        width: 100%;
    }

    /* === ТОСТЫ === */
    body.mobile .toast {
        min-width: auto;
        width: calc(100vw - 24px);
        font-size: 0.85rem;
        padding: 12px 14px;
    }

    body.mobile #toast-container {
        top: 52px;
    }

    /* === АДМИН-ПАНЕЛЬ === */
    body.mobile .admin-users-table {
        font-size: 0.78rem;
    }

    @keyframes slideUp {
        from { transform: translateY(100%); }
        to   { transform: translateY(0); }
    }
}
