:root {
    --bg: #f3f4f6;
    --panel: #ffffff;
    --panel-soft: #f9fafb;
    --text: #111827;
    --muted: #6b7280;
    --line: #e5e7eb;
    --brand: #111827;
    --brand-2: #2563eb;
    --success: #16a34a;
    --danger: #dc2626;
    --warning: #d97706;
    --shadow: 0 12px 35px rgba(17, 24, 39, 0.08);
}

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

body {
    min-height: 100vh;
    background: var(--bg);
    color: var(--text);
    font-family: "Segoe UI", Arial, sans-serif;
    font-size: 15px;
}

a {
    color: inherit;
}

#page-loader {
    position: fixed;
    inset: 0;
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(249, 250, 251, 0.86);
    backdrop-filter: blur(6px);
    transition: opacity 0.35s ease;
}

.loader-box {
    width: 180px;
    padding: 24px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel);
    text-align: center;
    box-shadow: var(--shadow);
}

.spinner {
    width: 34px;
    height: 34px;
    margin: 0 auto 12px;
    border: 3px solid var(--line);
    border-top-color: var(--brand);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loader-box p {
    color: var(--muted);
    font-size: 13px;
}

.navbar {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 12px 28px;
    background: #ffffff;
    border-bottom: 1px solid var(--line);
    box-shadow: 0 4px 20px rgba(17, 24, 39, 0.05);
}

.nav-left,
.nav-right,
.logo-link {
    display: flex;
    align-items: center;
}

.nav-right {
    gap: 8px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.logo-link {
    gap: 10px;
    text-decoration: none;
}

.logo {
    width: 38px;
    height: 38px;
    object-fit: contain;
}

.brand-name {
    color: var(--text);
    font-weight: 800;
    letter-spacing: 0;
}

.nav-right a {
    padding: 8px 10px;
    border-radius: 6px;
    color: var(--muted);
    text-decoration: none;
    font-weight: 600;
}

.nav-right a:hover {
    color: var(--text);
    background: var(--panel-soft);
}

.user-menu {
    position: relative;
    margin-left: 4px;
}

.avatar {
    width: 36px;
    height: 36px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: var(--brand);
    color: #fff;
    cursor: pointer;
    font-weight: 800;
}

.dropdown {
    position: absolute;
    top: 46px;
    right: 0;
    z-index: 30;
    display: none;
    width: 180px;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel);
    box-shadow: var(--shadow);
}

.dropdown p {
    margin: 4px 8px 8px;
    color: var(--muted);
}

.dropdown a {
    display: block;
    margin: 0;
    color: var(--text);
}

.container,
.dashboard-container {
    width: min(1180px, calc(100% - 32px));
    margin: 24px auto;
    overflow: visible;
}

.container.narrow {
    width: min(560px, calc(100% - 32px));
}

.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 18px;
}

h2,
.page-title,
.dashboard-title {
    margin: 18px 0;
    color: var(--text);
    text-align: center;
    font-size: 28px;
    font-weight: 800;
}

h3 {
    margin-bottom: 12px;
    color: var(--text);
}

form,
.app-form {
    width: min(520px, 100%);
    margin: 20px auto;
    padding: 22px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel);
    box-shadow: var(--shadow);
}

input,
select,
textarea,
button {
    width: 100%;
    padding: 12px 13px;
    margin-bottom: 14px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font: inherit;
}

textarea {
    min-height: 110px;
    resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--brand-2);
    outline: 3px solid rgba(37, 99, 235, 0.14);
}

.native-search-select {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
}

.searchable-select {
    position: relative;
    margin-bottom: 14px;
}

.searchable-select-trigger {
    position: relative;
    width: 100%;
    min-height: 44px;
    justify-content: flex-start;
    padding: 12px 42px 12px 13px;
    border: 1px solid #d1d5db;
    background: #fff;
    color: var(--text);
    font-weight: 400;
    text-align: left;
}

.searchable-select-trigger::after {
    content: "";
    position: absolute;
    top: 50%;
    right: 14px;
    width: 0;
    height: 0;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-top: 6px solid var(--muted);
    transform: translateY(-50%);
}

.searchable-select-panel {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    z-index: 25;
    padding: 8px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: #fff;
    box-shadow: var(--shadow);
}

.searchable-select-search {
    margin-bottom: 8px;
}

.searchable-select-list {
    max-height: 230px;
    overflow-y: auto;
}

.searchable-select-option {
    width: 100%;
    min-height: 38px;
    justify-content: flex-start;
    margin: 0;
    padding: 9px 10px;
    border-radius: 4px;
    background: #fff;
    color: var(--text);
    font-weight: 500;
    text-align: left;
}

.searchable-select-option:hover,
.searchable-select-option[aria-selected="true"] {
    background: var(--panel-soft);
    filter: none;
}

.searchable-select-option.is-blocked {
    color: var(--danger);
    font-weight: 700;
}

.searchable-select-empty {
    padding: 10px;
    color: var(--muted);
    text-align: center;
}

button,
.btn,
.btn-edit,
.btn-clear,
.action-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: auto;
    min-height: 36px;
    padding: 8px 13px;
    border: 0;
    border-radius: 6px;
    background: var(--brand);
    color: #fff;
    text-decoration: none;
    font-weight: 700;
    cursor: pointer;
}

form button {
    width: 100%;
    min-height: 44px;
}

button:hover,
.btn:hover,
.btn-edit:hover,
.btn-clear:hover,
.action-btn:hover {
    filter: brightness(0.94);
}

.btn-edit {
    background: var(--warning);
}

.btn-clear,
.btn-rent,
.btn-unblock {
    background: var(--success);
}

.btn-return,
.btn-block {
    background: var(--danger);
}

table,
.data-table,
.table {
    width: 100%;
    margin: 20px 0;
    border-collapse: collapse;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel);
    box-shadow: var(--shadow);
}

th,
td {
    padding: 13px 14px;
    border-bottom: 1px solid var(--line);
    text-align: left;
    vertical-align: middle;
}

th {
    background: #111827;
    color: #fff;
    font-size: 13px;
    text-transform: uppercase;
}

tr:nth-child(even) td {
    background: #fbfbfc;
}

tr:hover td {
    background: #f3f6fb;
}

.badge,
.badge-green,
.badge-red {
    display: inline-flex;
    align-items: center;
    min-height: 26px;
    padding: 4px 10px;
    border-radius: 999px;
    color: #fff;
    font-size: 12px;
    font-weight: 800;
}

.badge-green,
.badge-active,
.badge-returned {
    background: var(--success);
}

.badge-red,
.badge-blocked,
.badge-late {
    background: var(--danger);
}

.badge-rented {
    background: var(--brand-2);
}

.badge-yellow {
    background: var(--warning);
}

.dashboard,
.dashboard-cards,
.dashboard-top {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
    align-items: stretch;
}

.card,
.dashboard-card {
    min-height: 130px;
    padding: 20px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel);
    box-shadow: var(--shadow);
}

.card-link {
    color: inherit;
    text-decoration: none;
}

.card-number {
    margin: 8px 0;
    font-size: 34px;
    font-weight: 900;
}

.card small,
.card sm {
    color: var(--muted);
}

.card.danger,
.card-late {
    border-left: 5px solid var(--danger);
}

.card-success,
.card-sales {
    border-left: 5px solid var(--success);
}

.card-warning,
.card-today {
    border-left: 5px solid var(--warning);
}

.card-total,
.card-fine,
.available-card {
    border-left: 5px solid var(--brand-2);
}

.form-card,
.available-card {
    width: auto;
}

.table-card {
    grid-column: 1 / -1;
    
}

.top-bar {
    display: flex;
    justify-content: flex-end;
    padding: 12px 28px;
    background: #111827;
    color: #fff;
}

.search-box {
    box-shadow: none;
    border: 0;
    background: transparent;
    padding: 0;
}

.live-search,
.search-box input {
    width: min(480px, 100%);
    display: block;
    margin: 0 auto 14px;
    background: #fff;
}

.status-filters,
.pagination {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
    margin: 16px 0;
}

.status-filters a,
.pagination a {
    padding: 8px 13px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: #fff;
    color: var(--muted);
    text-decoration: none;
    font-weight: 700;
}

.status-filters a.active,
.pagination a.active {
    border-color: var(--brand);
    background: var(--brand);
    color: #fff;
}

.empty-text {
    padding: 18px;
    color: var(--muted);
    text-align: center;
}

.success {
    color: var(--success);
}

.error {
    color: var(--danger);
}

.login-page {
    display: grid;
    place-items: center;
    padding: 24px;
    background: linear-gradient(135deg, #f9fafb 0%, #eef2ff 100%);
}

.login-box {
    width: min(390px, 100%);
    padding: 30px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.96);
    box-shadow: var(--shadow);
    text-align: center;
}

.login-logo {
    width: 64px;
    height: 64px;
    object-fit: contain;
    margin-bottom: 12px;
}

.login-subtitle {
    margin-bottom: 20px;
    color: var(--muted);
}

.login-form {
    margin: 0;
    padding: 0;
    border: 0;
    box-shadow: none;
}

.secondary-link {
    display: block;
    margin-top: 8px;
    color: var(--brand-2);
    text-decoration: none;
    font-weight: 700;
}

.camera-panel {
    display: grid;
    gap: 12px;
    margin-bottom: 14px;
}

.camera-preview {
    position: relative;
    display: grid;
    place-items: center;
    min-height: 220px;
    overflow: hidden;
    border: 1px dashed #cbd5e1;
    border-radius: 8px;
    background: #f8fafc;
}

.camera-preview::before {
    content: "Passport";
    color: var(--muted);
    font-weight: 700;
}

.camera-preview video,
.camera-preview img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.camera-preview video,
.camera-preview img,
.camera-preview canvas {
    display: none;
}

.camera-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.camera-actions button {
    margin-bottom: 0;
}

.passport-thumb {
    width: 46px;
    height: 46px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #fff;
    box-shadow: 0 0 0 1px var(--line);
}

.modal {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(17, 24, 39, 0.5);
}

.modal-content {
    width: min(420px, calc(100% - 32px));
    padding: 24px;
    border-radius: 8px;
    background: var(--panel);
}

.modal-buttons {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

@media (max-width: 760px) {
    .navbar,
    .nav-right {
        align-items: flex-start;
        flex-direction: column;
    }

    .nav-right {
        width: 100%;
    }

    table {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
    }

    .page-header {
        align-items: stretch;
        flex-direction: column;
    }
}


.filter-group{
    display:flex;
    flex-direction:column;
    min-width:180px;
}

.report-cards{
    display:grid;
    grid-template-columns:repeat(auto-fit,minmax(200px,1fr));
    gap:20px;
    margin:20px 0;
}

.report-card{
    background:#fff;
    border-radius:12px;
    padding:20px;
    box-shadow:0 2px 8px rgba(0,0,0,.08);
    border-left:5px solid #2563eb;
}

.report-card h2{
    margin-top:10px;
    font-size:2rem;
}

.card-label{
    color:#666;
    font-size:.9rem;
    text-transform:uppercase;
    letter-spacing:.5px;
}

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

@media(max-width:768px){

   

    .filter-group{
        width:100%;
    }
}


.report-filter-row{
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 15px;
    width: 100%;
}

.report-filter-row input,
.report-filter-row select{
    min-width:180px;
    height:42px;
}

.report-filter-row button{
    height:42px;
    white-space:nowrap;
}
.table-wrapper{
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* force table to stay wide so scroll appears */
.data-table{
    min-width: 1100px;
}

@media (max-width:768px){

    .data-table{
        min-width: 500px;
        font-size: 15px;
    }

    th, td{
        padding: 15px;
    }
    
}
.table-wrapper{
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    display: block;
    -webkit-overflow-scrolling: touch;
}

.data-table{
    width: max-content;
    min-width: 1100px;
    border-collapse: collapse;
}

.container,
.dashboard-container{
    overflow: visible;
}
.table-wrapper{
    max-width: 100%;
    overflow-x: auto;
}

.data-table{
    border-collapse: collapse;
    min-width: 1000px;
}

.data-table thead th{
    position: sticky;
    top: 0;
    z-index: 10;
}
.data-table th{
    text-align: center;
}

.data-table td:nth-child(1){
    text-align: center; /* SN */
}

.data-table td:nth-child(2),
.data-table td:nth-child(3),
.data-table td:nth-child(4){
    text-align: left; /* text fields */
}

.data-table td:nth-child(5),
.data-table td:nth-child(6),
.data-table td:nth-child(7){
    text-align: center; /* dates */
}
.data-table th,
.data-table td{
    vertical-align: middle;
}
/* toggle button */
.nav-toggle{
    display:none;
    background: var(--brand);
    color: #fff;
    border: none;
    padding: 10px 14px;
    border-radius: 6px;
    font-weight: 700;
    cursor: pointer;
}

/* dropdown container */
.nav-right{
    display: flex;
    gap: 8px;
    align-items: center;
}

/* MOBILE DROPDOWN */
@media (max-width: 768px){

    .nav-toggle{
        display:block;
    }

    .nav-right{
        position: absolute;
        top: 65px;
        left: 16px;
        right: 16px;
        flex-direction: column;
        background: #fff;
        border: 1px solid var(--line);
        border-radius: 10px;
        box-shadow: var(--shadow);
        padding: 10px;
        display: none; /* hidden by default */
        z-index: 999;
    }

    .nav-right.active{
        display: flex;
    }

    .nav-right a{
        width: 100%;
        padding: 12px;
        border-bottom: 1px solid var(--line);
    }

    .nav-right a:last-child{
        border-bottom: none;
    }
}

.passport-thumb-large{
    max-width:100%;
    height:auto;
    border-radius:10px;
    border:1px solid #ddd;
    display:block;
}