:root {
    --primary: #1300d8;
    --primary-dark: #1f1958;
    --sidebar: #171342;
    --bg: #f6f3ff;
    --card: #fff;
    --muted: #777b90;
    --text: #17172a;
    --border: #deddf0;
    --success: #16a34a;
    --warning: #f59e0b;
    --danger: #dc2626;
    --action-view: #4f46e5;
    --action-view-bg: rgba(79, 70, 229, .12);
    --action-view-hover: #4338ca;
    --action-edit: #f59e0b;
    --action-edit-bg: rgba(245, 158, 11, .12);
    --action-edit-hover: #d97706;
    --action-delete: #ef4444;
    --action-delete-bg: rgba(239, 68, 68, .12);
    --action-delete-hover: #dc2626;
    --radius: 14px;
    --shadow: 0 10px 28px rgba(25, 20, 80, .08);
    --font: 'Inter', 'Segoe UI', Arial, sans-serif
}

* {
    box-sizing: border-box
}

body {
    margin: 0;
    font-family: var(--font);
    background: var(--bg);
    color: var(--text)
}

a {
    text-decoration: none;
    color: inherit
}

.sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: 250px;
    background: var(--sidebar);
    color: #fff;
    padding: 24px 18px;
    display: flex;
    flex-direction: column;
    gap: 10px
}

.brand {
    font-size: 20px;
    font-weight: 800
}

.brand small {
    display: block;
    font-size: 12px;
    color: #bdb8ea;
    margin-top: 4px
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 13px 14px;
    border-radius: 10px;
    color: #d8d5ff;
    font-weight: 600
}

.nav-link:hover {
    background: rgba(255, 255, 255, .12);
    color: #fff
}

.nav-link.active {
    background: #c5b8ff;
    color: #1300d8
}

.nav-badge {
    margin-left: auto;
    min-width: 22px;
    height: 22px;
    padding: 0 7px;
    border-radius: 999px;
    background: var(--danger);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 800;
    line-height: 1
}

.nav-badge[hidden] {
    display: none
}

.sidebar-footer {
    margin-top: auto;
    border-top: 1px solid rgba(255, 255, 255, .12);
    padding-top: 16px
}

.logout-btn {
    width: 100%;
    border: 0;
    background: transparent;
    color: #ff7b7b;
    text-align: left;
    padding: 12px 14px;
    font-weight: 700;
    cursor: pointer
}

.content {
    margin-left: 250px;
    min-height: 100vh
}

.topbar {
    height: 72px;
    background: #fff;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 28px
}

.topbar-title {
    font-size: 14px;
    color: var(--muted)
}

.page {
    padding: 28px
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 22px
}

.page-header h1 {
    font-size: 30px;
    margin: 0 0 6px
}

.page-header p {
    margin: 0;
    color: var(--muted)
}

.btn-primary,
.btn-secondary,
.icon-btn {
    border: 0;
    border-radius: 10px;
    padding: 12px 18px;
    font-weight: 800;
    cursor: pointer;
    transition: background .15s ease, color .15s ease, transform .15s ease;
}

.btn-primary {
    background: var(--primary);
    color: #fff;
}

.btn-secondary {
    background: #fff;
    border: 1px solid var(--border);
    color: var(--text);
}

.icon-btn {
    padding: 8px 12px;
    background: #eef0ff;
    color: var(--primary);
}

.icon-btn:hover {
    transform: translateY(-1px);
}

.icon-btn.action-view {
    background: var(--action-view-bg);
    color: var(--action-view);
}

.icon-btn.action-view:hover,
.icon-btn.action-view:focus {
    background: rgba(79, 70, 229, .18);
    color: var(--action-view-hover);
}

.icon-btn.action-edit {
    background: var(--action-edit-bg);
    color: var(--action-edit);
}

.icon-btn.action-edit:hover,
.icon-btn.action-edit:focus {
    background: rgba(245, 158, 11, .18);
    color: var(--action-edit-hover);
}

.icon-btn.action-delete,
.icon-btn.danger {
    background: var(--action-delete-bg);
    color: var(--action-delete);
}

.icon-btn.action-delete:hover,
.icon-btn.action-delete:focus,
.icon-btn.danger:hover,
.icon-btn.danger:focus {
    background: rgba(239, 68, 68, .18);
    color: var(--action-delete-hover);
}

.icon-btn.icon-btn-compact {
    padding: 8px;
    width: 36px;
    min-width: 36px;
    height: 36px;
    display: grid;
    place-items: center;
}

.client-vehicles-cell {
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    min-width: 96px;
}

.vehicle-count {
    min-width: 2.8rem;
    text-align: right;
    font-weight: 700;
}

#clientVehiclesModal .client-vehicles-modal-body {
    max-height: 420px;
    overflow-y: auto;
    overflow-x: hidden;
    scroll-behavior: smooth;
    padding-right: 10px;
}

#clientVehiclesModal .client-vehicles-modal-body table {
    width: 100%;
    table-layout: fixed;
}

#clientVehiclesModal .client-vehicles-modal-body th,
#clientVehiclesModal .client-vehicles-modal-body td {
    white-space: normal;
    word-break: break-word;
}

#clientVehiclesModal .client-vehicles-modal-body th:nth-child(1),
#clientVehiclesModal .client-vehicles-modal-body td:nth-child(1) {
    width: 12%;
}

#clientVehiclesModal .client-vehicles-modal-body th:nth-child(5),
#clientVehiclesModal .client-vehicles-modal-body td:nth-child(5) {
    width: 12%;
}

#clientVehiclesModal .client-vehicles-modal-body th:nth-child(9),
#clientVehiclesModal .client-vehicles-modal-body td:nth-child(9) {
    width: 8%;
    text-align: center;
}

#clientVehiclesModal .client-vehicles-modal-body::-webkit-scrollbar {
    width: 8px;
}

#clientVehiclesModal .client-vehicles-modal-body::-webkit-scrollbar-thumb {
    background: rgba(17, 18, 34, .16);
    border-radius: 999px;
}

.cards-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 20px;
    margin-bottom: 28px
}

.stat-card,
.content-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow)
}

.stat-card {
    padding: 22px
}

.stat-card.clickable,
.stat-card.clickable-card {
    cursor: pointer;
    transition: transform .3s ease, box-shadow .3s ease, border-color .3s ease
}

.stat-card.clickable:hover,
.stat-card.clickable-card:hover {
    transform: translateY(-2px) scale(1.03);
    border-color: var(--primary);
    box-shadow: 0 24px 48px rgba(15, 23, 49, .08)
}

.stat-card.active {
    border-color: var(--primary);
    background: rgba(19, 0, 216, .08)
}

.stat-card label {
    font-size: 12px;
    color: var(--muted);
    font-weight: 800;
    letter-spacing: .04em;
    text-transform: uppercase
}

.stat-card h2 {
    font-size: 32px;
    margin: 16px 0 0
}

.content-card {
    padding: 20px;
    margin-bottom: 22px
}

.toolbar {
    display: flex;
    justify-content: space-between;
    gap: 14px;
    align-items: center;
    margin-bottom: 18px
}

.search-input {
    height: 44px;
    border: 1px solid var(--border);
    border-radius: 22px;
    padding: 0 18px;
    min-width: 320px;
    background: #f9f8ff
}

.data-table {
    width: 100%;
    border-collapse: collapse
}

.data-table th {
    font-size: 12px;
    color: var(--muted);
    text-transform: uppercase;
    text-align: left;
    background: #fafaff;
    padding: 14px
}

.data-table td {
    border-top: 1px solid var(--border);
    padding: 15px;
    color: #33384d
}

.pagination-wrapper {
    width: 100%;
    padding-top: 18px
}

.pagination-wrapper-info {
    display: grid;
    width: 100%;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    align-items: center;
    gap: 16px 20px
}

.pagination-info {
    display: contents;
    color: var(--muted);
    font-size: 13px;
    font-weight: 600;
    line-height: 1.5
}

.pagination-info span:first-child {
    justify-self: start;
    white-space: nowrap
}

.pagination-info span:last-child {
    grid-column: 2;
    justify-self: center;
    text-align: center;
    white-space: nowrap
}

.pagination-nav {
    grid-column: 3;
    width: 100%;
    display: flex;
    justify-content: flex-end;
    justify-self: end
}

.pagination-list {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 8px;
    list-style: none;
    margin: 0;
    padding: 0
}

.page-item {
    display: inline-flex
}

.page-link {
    border: 1px solid var(--border);
    border-radius: 12px;
    min-width: 44px;
    height: 44px;
    padding: 0 16px;
    background: #fff;
    color: var(--text);
    font-weight: 700;
    cursor: pointer;
    transition: all .15s ease
}

.page-link:hover {
    background: #f8f7ff
}

.page-item.active .page-link {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff
}

.page-item.disabled .page-link {
    background: #f5f5f7;
    color: #9ea3b8;
    cursor: default;
    border-color: #e9e9f5
}

.empty-cell {
    text-align: center;
    color: var(--muted) !important
}

.status {
    display: inline-block;
    border-radius: 20px;
    padding: 5px 10px;
    font-size: 12px;
    font-weight: 800
}

.status-active {
    background: #dcfce7;
    color: #15803d
}

.status-expiring {
    background: #fff7ed;
    color: #c2410c
}

.status-expired {
    background: #fee2e2;
    color: #b91c1c
}

.status-renewed {
    background: #e0e7ff;
    color: #3730a3
}

.modal-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(17, 18, 34, .48);
    backdrop-filter: blur(4px);
    z-index: 20;
    align-items: center;
    justify-content: center
}

.modal-backdrop.show {
    display: flex
}

.modal {
    width: min(560px, 94vw);
    background: #fff;
    border-radius: 18px;
    box-shadow: 0 26px 70px rgba(0, 0, 0, .25);
    overflow: hidden
}

.modal-lg {
    width: min(960px, 96vw)
}

.modal-sm {
    width: min(420px, 94vw)
}

.modal-header {
    padding: 24px 28px;
    background: #fbf9ff;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: flex-start
}

.modal-header h2 {
    margin: 0 0 6px
}

.modal-header p {
    margin: 0;
    color: var(--muted)
}

.modal-close {
    border: 0;
    background: transparent;
    font-size: 30px;
    cursor: pointer;
    color: #202033
}

.modal-body {
    padding: 24px 28px;
}

.modal-body .form-group input,
.modal-body .form-group select,
.modal-body .form-group textarea {
    min-height: 46px;
}

.delete-confirm-body {
    display: flex;
    align-items: center;
    gap: 18px;
    padding: 20px 28px 22px
}

.delete-confirm-icon {
    width: 56px;
    height: 56px;
    display: grid;
    place-items: center;
    border-radius: 18px;
    background: rgba(220, 38, 38, .1);
    color: #dc2626;
    font-size: 1.75rem
}

.delete-confirm-text {
    margin: 0;
    color: #444655;
    font-weight: 600;
    line-height: 1.5
}

.modal-footer {
    padding: 18px 28px;
    background: #fbf9ff;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
    gap: 14px
}

.cust_form-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px
}

.cust_form-group {
    display: flex;
    flex-direction: column;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.form-group.full {
    grid-column: 1/-1
}

.form-group label {
    font-weight: 800;
    font-size: 13px;
    color: #2b2b45
}

.form-control,
input,
select,
textarea {
    width: 100%;
    border: 1px solid #cfcee4;
    border-radius: 10px;
    padding: 13px 14px;
    font: inherit;
    background: #fff
}

textarea {
    min-height: 90px;
    resize: vertical
}

.login-body {
    display: grid;
    place-items: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #171342, #2e24b8)
}

.login-card {
    width: 390px;
    background: #fff;
    border-radius: 18px;
    padding: 32px;
    box-shadow: var(--shadow)
}

.login-card h1 {
    margin: 0 0 8px
}

.login-card p {
    color: var(--muted)
}

.login-card input {
    margin-bottom: 14px
}

.login-card button {
    width: 100%
}

.error-text {
    color: var(--danger);
    font-weight: 700
}

.filter-row {
    display: flex;
    gap: 12px;
    align-items: end;
    flex-wrap: wrap
}

.filter-row .form-group {
    min-width: 220px
}

@media(max-width:1100px) {
    .cards-grid {
        grid-template-columns: repeat(2, 1fr)
    }

    .sidebar {
        width: 220px
    }

    .content {
        margin-left: 220px
    }
}

@media(max-width:760px) {
    .sidebar {
        position: static;
        width: auto
    }

    .content {
        margin-left: 0
    }

    .cards-grid,
    .form-grid {
        grid-template-columns: 1fr
    }

    .page-header,
    .toolbar {
        align-items: flex-start;
        flex-direction: column
    }

    .search-input {
        min-width: 100%
    }
}

#renewModal input:disabled {
    color: #6c757d;
    cursor: not-allowed;
    background-color: #e9ecef;
    border-color: #ced4da;
    box-shadow: none
}

.select2-container {
    width: 100% !important;
    font: inherit
}

.select2-container--bootstrap-5 .select2-selection {
    min-height: 48px;
    border: 1px solid #cfcee4;
    border-radius: 10px;
    background: #fff;
    font: inherit
}

.select2-container--bootstrap-5 .select2-selection--single {
    padding: 8px 14px
}

.select2-container--bootstrap-5 .select2-selection--single .select2-selection__rendered {
    padding: 0;
    color: var(--text);
    line-height: 30px
}

.select2-container--bootstrap-5 .select2-selection--single .select2-selection__placeholder {
    color: var(--muted)
}

.select2-container--bootstrap-5 .select2-selection--single .select2-selection__arrow {
    height: 46px
}

.select2-container--bootstrap-5.select2-container--focus .select2-selection,
.select2-container--bootstrap-5.select2-container--open .select2-selection {
    border-color: var(--primary);
    box-shadow: 0 0 0 .2rem rgba(19, 0, 216, .12)
}

.select2-container--bootstrap-5 .select2-dropdown {
    border-color: #cfcee4;
    border-radius: 10px;
    box-shadow: var(--shadow);
    overflow: hidden
}

.select2-container--bootstrap-5 .select2-search__field {
    border: 1px solid #cfcee4;
    border-radius: 8px;
    padding: 9px 10px;
    font: inherit
}

.select2-container--bootstrap-5 .select2-results__option {
    padding: 10px 14px
}

.select2-container--bootstrap-5 .select2-results__option--highlighted {
    background: var(--primary);
    color: #fff
}

.select2-container--bootstrap-5 .select2-selection__clear {
    height: 28px;
    margin-right: 8px;
    color: var(--muted)
}

.modal .select2-container {
    z-index: 21
}

.select2-container--open {
    z-index: 30
}

.status-active {
    background: transparent;
    color: #15803d
}

.status-expiring {
    background: transparent;
    color: #c2410c
}

.status-expired {
    background: transparent;
    color: #b91c1c
}

.status-renewed {
    background: transparent;
    color: #3730a3
}

@media(max-width:760px) {
    .pagination-wrapper-info {
        grid-template-columns: 1fr
    }

    .pagination-info span:first-child,
    .pagination-info span:last-child,
    .pagination-nav {
        grid-column: 1;
        justify-self: start
    }

    .pagination-nav,
    .pagination-list {
        justify-content: flex-start
    }
}