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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: #f5f5f5;
    color: #333;
}

.container {
    display: flex;
    height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 250px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px;
    overflow-y: auto;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
}

.sidebar h2 {
    margin-bottom: 30px;
    font-size: 24px;
}

.sidebar nav {
    margin-bottom: 30px;
}

.nav-btn {
    display: block;
    width: 100%;
    padding: 12px;
    margin-bottom: 10px;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    font-size: 16px;
    text-align: left;
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.3s ease;
}

.nav-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateX(5px);
}

.nav-btn.active {
    background: rgba(255, 255, 255, 0.4);
    font-weight: bold;
    border-left: 4px solid white;
}

.status {
    background: rgba(255, 255, 255, 0.1);
    padding: 15px;
    border-radius: 6px;
    font-size: 14px;
}

.status p {
    margin-bottom: 10px;
}

.status p:last-child {
    margin-bottom: 0;
}

/* Main Content */
.main-content {
    flex: 1;
    overflow-y: auto;
    padding: 30px;
}

.main-content h1 {
    margin-bottom: 20px;
    color: #333;
}

.tab {
    display: none;
}

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

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

/* Filters */
.filters {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.filters input,
.filters select {
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
}

.filters button {
    padding: 10px 20px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    transition: background 0.3s ease;
}

.filters button:hover {
    background: #764ba2;
}

/* Table */
.table-container {
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

thead {
    background: #f8f9fa;
    border-bottom: 2px solid #dee2e6;
}

th {
    padding: 12px;
    text-align: left;
    font-weight: 600;
    color: #495057;
}

td {
    padding: 12px;
    border-bottom: 1px solid #dee2e6;
}

tbody tr:hover {
    background: #f8f9fa;
}

/* Live Info */
.live-info {
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.live-info h3 {
    margin-bottom: 15px;
    color: #333;
}

.vehicles-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 15px;
}

.vehicle-card {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 6px;
    border-left: 4px solid #667eea;
}

.vehicle-card p {
    margin: 5px 0;
    font-size: 13px;
}

.vehicle-card strong {
    display: block;
    margin-bottom: 8px;
    color: #333;
}

/* Report */
.report-section {
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.report-section h3 {
    margin: 20px 0 10px 0;
    color: #333;
}

.checkpoint {
    background: #f8f9fa;
    padding: 12px;
    margin: 10px 0;
    border-radius: 6px;
    border-left: 3px solid #28a745;
}

.checkpoint.departure {
    border-left-color: #dc3545;
}

/* Settings */
.settings-form {
    background: white;
    padding: 20px;
    border-radius: 8px;
    max-width: 500px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

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

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

.form-group input,
.form-group select {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
}

.form-group small {
    display: block;
    margin-top: 4px;
    color: #999;
    font-size: 12px;
}

.settings-form button {
    width: 100%;
    padding: 12px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.3s ease;
}

.settings-form button:hover {
    background: #764ba2;
}

/* Status Indicators */
.status-badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
}

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

.status-badge.completed {
    background: #cce5ff;
    color: #004085;
}

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

/* Action Buttons */
.action-btn {
    padding: 6px 12px;
    margin: 0 4px;
    border: none;
    background: #667eea;
    color: white;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    transition: background 0.3s ease;
}

.action-btn:hover {
    background: #764ba2;
}

.actions-cell {
    white-space: nowrap;
}

/* Иконка карты: тот же размер, что у текстовых кнопок, но квадратная */
.action-btn.icon-btn {
    font-size: 15px;
    line-height: 1;
    padding: 6px 9px;
}

.action-btn.danger {
    background: #dc3545;
}

.action-btn.danger:hover {
    background: #c82333;
}

/* Responsive */
@media (max-width: 768px) {
    .container {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        height: auto;
    }

    .main-content {
        padding: 15px;
    }

    .vehicles-list {
        grid-template-columns: 1fr;
    }

    table {
        font-size: 12px;
    }

    th, td {
        padding: 8px;
    }
}

/* Loading state */
.loading {
    opacity: 0.6;
    pointer-events: none;
}

/* Success/Error messages */
.message {
    padding: 12px;
    border-radius: 6px;
    margin-bottom: 15px;
    animation: slideIn 0.3s ease;
}

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

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

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

/* ================= Вход сотрудника ================= */

.login-screen {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    z-index: 1000;
}

.login-box {
    background: white;
    padding: 32px;
    border-radius: 10px;
    width: 320px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.25);
}

.login-box h2 { margin-bottom: 4px; }
.login-sub { color: #777; font-size: 13px; margin-bottom: 20px; }

.login-box input {
    width: 100%;
    padding: 11px;
    margin-bottom: 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 15px;
}

.login-box button {
    width: 100%;
    padding: 12px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 15px;
    cursor: pointer;
}

.login-box button:disabled { opacity: .6; cursor: default; }
.login-error { color: #dc3545; font-size: 13px; margin-top: 10px; min-height: 18px; }

/* ================= Боковая панель ================= */

.user-box {
    margin-top: 16px;
    padding-top: 12px;
    border-top: 1px solid rgba(255, 255, 255, .25);
    font-size: 13px;
}

.link-btn {
    background: none;
    border: none;
    color: white;
    text-decoration: underline;
    cursor: pointer;
    padding: 4px 0;
    font-size: 13px;
}

/* Счётчик новых анкет прямо в меню: диспетчер видит их, не заходя в раздел */
.badge {
    display: none;
    background: #dc3545;
    color: white;
    border-radius: 10px;
    padding: 1px 7px;
    font-size: 12px;
    margin-left: 6px;
}

/* ================= Карточка водителя ================= */

.driver-card {
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, .1);
}

.driver-card h4 { margin: 18px 0 8px; }

.driver-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
    gap: 12px;
    margin-bottom: 8px;
}

.driver-grid > div {
    background: #f8f9fa;
    padding: 10px;
    border-radius: 6px;
    font-size: 13px;
}

.doc-thumbs { display: flex; flex-wrap: wrap; gap: 12px; }

.doc-thumb {
    margin: 0;
    width: 190px;
    text-align: center;
    font-size: 12px;
}

.doc-thumb img {
    width: 100%;
    height: 130px;
    object-fit: cover;
    border-radius: 6px;
    border: 1px solid #ddd;
    background: #f0f0f0;
    cursor: zoom-in;
}

.doc-thumb img:hover { opacity: .85; }

.history { font-size: 13px; }

.history-row {
    display: grid;
    grid-template-columns: 150px 200px 130px 1fr;
    gap: 8px;
    padding: 6px 0;
    border-bottom: 1px solid #eee;
}

.approve-bar {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid #eee;
    flex-wrap: wrap;
}

.approve-bar input {
    flex: 1;
    min-width: 200px;
    padding: 9px;
    border: 1px solid #ddd;
    border-radius: 6px;
}

.vehicle-row {
    padding: 8px;
    border-bottom: 1px solid #eee;
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Статусы водителя — те же цвета, что у статусов рейса */
.status-badge.pending   { background: #fff3cd; color: #856404; }
.status-badge.approved  { background: #d4edda; color: #155724; }
.status-badge.rejected  { background: #f8d7da; color: #721c24; }
.status-badge.suspended { background: #e2e3e5; color: #383d41; }
