* { box-sizing: border-box; }
body {
    margin: 0;
    font-family: 'Inter', -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
    background: #f4f5f7;
    color: #1f2430;
    font-size: 16px;
    font-weight: 500;
}
.wrap {
    max-width: 1100px;
    margin: 0 auto;
    padding: 24px 16px 60px;
}
.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}
.topbar h1 {
    font-size: 26px;
    margin: 0;
    font-weight: 600;
}
.logout {
    color: #6b7280;
    text-decoration: none;
    font-size: 16px;
    font-weight: 500;
}
.logout:hover { text-decoration: underline; }

.search-row {
    display: flex;
    gap: 10px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}
.search-row input {
    flex: 1;
    min-width: 180px;
    padding: 12px 14px;
    border: 1px solid #d7d9df;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 500;
}

/* Автокомплит */
.autocomplete-wrapper {
    position: relative;
    flex: 1;
    min-width: 180px;
}

.autocomplete-dropdown {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid #d7d9df;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    max-height: 300px;
    overflow-y: auto;
    z-index: 100;
    animation: dropdownSlide 0.2s ease;
}

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

.autocomplete-item {
    padding: 12px 14px;
    cursor: pointer;
    border-bottom: 1px solid #f3f4f6;
    transition: background 0.15s;
}

.autocomplete-item:last-child {
    border-bottom: none;
}

.autocomplete-item:hover,
.autocomplete-item.active {
    background: #f0f7ff;
}

.autocomplete-plate {
    font-weight: 600;
    color: #1f2430;
    font-size: 16px;
    margin-bottom: 4px;
}

.autocomplete-details {
    font-size: 13px;
    color: #6b7280;
}

.autocomplete-box {
    display: inline-block;
    background: #e0e7ff;
    color: #3730a3;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 600;
    margin-right: 8px;
}

.autocomplete-no-results {
    padding: 12px 14px;
    color: #9ca3af;
    font-size: 14px;
    text-align: center;
}
.add-btn {
    background: #2563eb;
    color: #fff;
    border: none;
    padding: 12px 18px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 600;
    white-space: nowrap;
}
.add-btn:hover { background: #1d4ed8; }

.table-wrap {
    background: #fff;
    border-radius: 10px;
    overflow-x: auto;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}
table {
    width: 100%;
    border-collapse: collapse;
    font-size: 16px;
    font-weight: 500;
}
th, td {
    padding: 14px 12px;
    text-align: left;
    border-bottom: 1px solid #eef0f3;
    font-size: 17px;
}
th {
    background: #fafbfc;
    font-weight: 600;
    color: #4b5563;
    user-select: none;
}
th.sortable { cursor: pointer; }
th.sortable:hover { color: #2563eb; }
.arrow { font-size: 11px; }

td[contenteditable="true"] {
    cursor: text;
    min-width: 60px;
}
td[contenteditable="true"]:focus {
    outline: 2px solid #93c5fd;
    outline-offset: -2px;
    background: #f0f7ff;
}
td.cell-error {
    outline: 2px solid #ef4444;
}
.del-btn {
    background: none;
    border: none;
    color: #9ca3af;
    cursor: pointer;
    font-size: 15px;
    padding: 4px 8px;
    border-radius: 6px;
}
.del-btn:hover { color: #ef4444; background: #fef2f2; }

.loading, .error-row {
    text-align: center;
    color: #9ca3af;
    padding: 30px 0;
}

.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: #f4f5f7;
}
.login-box {
    background: #fff;
    padding: 32px;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    width: 280px;
    text-align: center;
}
.login-box h1 {
    font-size: 22px;
    margin: 0 0 20px;
    font-weight: 600;
}
.login-box input {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid #d7d9df;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 500;
    margin-bottom: 12px;
}
.login-box button {
    width: 100%;
    padding: 12px;
    background: #2563eb;
    color: #fff;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 600;
}
.login-box button:hover { background: #1d4ed8; }
.login-box .error { color: #ef4444; font-size: 13px; margin-bottom: 12px; }

/* Модальное окно */
.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;
    animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-box {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    animation: slideUp 0.3s ease;
}

.modal-box.modal-small {
    max-width: 420px;
}

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

.modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid #eef0f3;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-header h3 {
    margin: 0;
    font-size: 20px;
    font-weight: 600;
    color: #1f2430;
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    color: #9ca3af;
    cursor: pointer;
    padding: 4px 8px;
    line-height: 1;
    border-radius: 6px;
}

.modal-close:hover {
    background: #f3f4f6;
    color: #4b5563;
}

.modal-body {
    padding: 24px;
}

.modal-section {
    margin-bottom: 20px;
}

.modal-section:last-child {
    margin-bottom: 0;
}

.modal-section-title {
    font-size: 14px;
    font-weight: 600;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 12px;
}

.modal-info-grid {
    display: grid;
    gap: 12px;
}

.modal-info-item {
    display: flex;
    padding: 12px;
    background: #f9fafb;
    border-radius: 8px;
    border-left: 3px solid #2563eb;
}

.modal-info-label {
    font-weight: 600;
    color: #4b5563;
    min-width: 120px;
}

.modal-info-value {
    color: #1f2430;
}

.modal-renter-card {
    padding: 16px;
    background: #f0f7ff;
    border-radius: 8px;
    border-left: 3px solid #3b82f6;
    margin-bottom: 12px;
}

.modal-renter-card:last-child {
    margin-bottom: 0;
}

.modal-renter-header {
    font-weight: 600;
    color: #1e40af;
    margin-bottom: 10px;
    font-size: 15px;
}

.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid #eef0f3;
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

.modal-btn {
    padding: 10px 20px;
    border-radius: 8px;
    border: none;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.modal-btn-primary {
    background: #2563eb;
    color: #fff;
}

.modal-btn-primary:hover {
    background: #1d4ed8;
}

.modal-btn-secondary {
    background: #f3f4f6;
    color: #4b5563;
}

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

.modal-btn-success {
    background: #10b981;
    color: #fff;
}

.modal-btn-success:hover {
    background: #059669;
}
