/* =========================================================
   GLOBAL
   ========================================================= */

* {
    box-sizing: border-box;
}

html {
    width: 100%;
    max-width: 100%;
    margin: 0;
    padding: 0;
}

body {
    width: 100%;
    max-width: 100%;
    margin: 0;

    background: #f3f6f9;
    color: #142033;

    font: 16px Arial, sans-serif;

    background-repeat: no-repeat;

    overflow-x: hidden;
}

.wrap {
    width: 100%;
    max-width: 1180px;

    margin: 24px auto;
    padding: 0 16px;
}


/* =========================================================
   NAVIGATION
   ========================================================= */

.topbar {
    position: relative;

    width: 100%;
    max-width: 100%;

    display: flex;
    align-items: center;
    flex-wrap: nowrap;

    gap: 12px;

    background: #fff;

    border: 1px solid #e2e8f0;
    border-radius: 14px;

    padding: 10px 12px;
    margin-bottom: 20px;

    box-shadow: 0 2px 12px #0000000d;
}


/* Brand */

.brand {
    display: flex;
    align-items: center;

    gap: 9px;

    color: #142033;

    text-decoration: none;

    font-weight: 800;

    white-space: nowrap;

    flex-shrink: 0;

    min-width: 0;
}

.brandmark {
    display: grid;
    place-items: center;

    width: 34px;
    height: 34px;

    border-radius: 9px;

    background: #174a7e;
    color: #fff;

    flex-shrink: 0;
}

.brandtext {
    white-space: nowrap;
}


/* Desktop navigation */

.navlinks {
    display: flex;
    align-items: center;

    flex-wrap: nowrap;

    gap: 8px;

    min-width: 0;
}

.navbtn,
.logoutbtn {
    display: inline-flex;
    align-items: center;
    justify-content: center;

    min-height: 38px;

    padding: 8px 13px;

    border-radius: 8px;

    text-decoration: none;

    font-weight: 700;

    white-space: nowrap;

    flex-shrink: 0;
}

.navbtn {
    color: #174a7e;
    background: #edf4fb;
}

.navbtn:hover {
    background: #dceaf7;
}


/* Account area */

.account {
    margin-left: auto;

    display: flex;
    align-items: center;

    flex-wrap: nowrap;

    gap: 8px;

    flex-shrink: 0;
}

.userpill {
    display: flex;
    align-items: center;

    gap: 7px;

    background: #f3f6f9;

    border-radius: 999px;

    padding: 7px 10px;

    white-space: nowrap;

    flex-shrink: 0;
}

.userpill b {
    font-size: 11px;

    text-transform: uppercase;

    letter-spacing: .4px;

    background: #dceaf7;
    color: #174a7e;

    border-radius: 999px;

    padding: 3px 7px;
}

.logoutbtn {
    background: #174a7e;
    color: #fff;
}

.logoutbtn:hover {
    background: #123e69;
}


/* =========================================================
   NFC NOTIFICATION BELL
   ========================================================= */

.notificationbell,
.notificationbell:link,
.notificationbell:visited,
.notificationbell:hover,
.notificationbell:active {
    position: relative;

    display: inline-flex;
    align-items: center;
    justify-content: center;

    width: 42px;
    height: 42px;

    border-radius: 12px;

    text-decoration: none !important;

    border-bottom: none !important;

    background: #eef4fa;
    color: #174f86;

    flex-shrink: 0;

    transition: background .15s ease;
}

.notificationbell:hover {
    background: #ddeaf6;
}

.notificationbell *,
.notificationbell span {
    text-decoration: none !important;
    border-bottom: none !important;
}

.bellicon {
    font-size: 20px;
    line-height: 1;
}

.notificationcount {
    position: absolute;

    top: -5px;
    right: -5px;

    min-width: 19px;
    height: 19px;

    padding: 0 5px;

    display: flex;
    align-items: center;
    justify-content: center;

    border-radius: 999px;

    background: #b02a2a;
    color: #fff;

    font-size: 11px;
    font-weight: 700;

    border: 2px solid #fff;
}


/* =========================================================
   MOBILE MENU
   ========================================================= */

.mobilemenubtn {
    display: none;
}

.mobilemenu {
    display: none;
}


/* =========================================================
   CARDS
   ========================================================= */

.card {
    width: 100%;
    max-width: 100%;

    background: #fffffff2;

    backdrop-filter: blur(3px);

    border-radius: 14px;

    padding: 22px;

    margin: 0 0 18px;

    box-shadow: 0 2px 12px #00000012;

    overflow-wrap: break-word;
}


/* =========================================================
   HEADINGS
   ========================================================= */

h1 {
    margin-top: 0;
    font-size: 30px;
}

h2 {
    margin: 0 0 10px;
}

a {
    color: #164d86;
}


/* =========================================================
   GRID
   ========================================================= */

.grid {
    display: grid;

    grid-template-columns:
        repeat(auto-fit, minmax(180px, 1fr));

    gap: 16px;

    margin: 20px 0;

    width: 100%;
    max-width: 100%;
}


/* =========================================================
   FORMS
   ========================================================= */

label {
    display: block;

    font-weight: 600;

    margin: 14px 0 6px;
}

input,
select,
textarea {
    width: 100%;
    max-width: 100%;

    padding: 12px;

    border: 1px solid #cbd5df;

    border-radius: 8px;

    font: inherit;

    background: #fff;
}

textarea {
    resize: vertical;
}


/* =========================================================
   BUTTONS
   ========================================================= */

button,
.btn {
    display: inline-block;

    background: #174a7e;
    color: #fff;

    border: 0;

    border-radius: 8px;

    padding: 11px 16px;

    text-decoration: none;

    font-weight: 600;

    cursor: pointer;

    margin-top: 12px;
}

button:hover,
.btn:hover {
    filter: brightness(.96);
}

.secondary {
    background: #52677c;
}

.danger {
    background: #9b2c2c;
}


/* =========================================================
   SEARCH
   ========================================================= */

.search {
    display: flex;

    gap: 10px;

    width: 100%;
}

.search input {
    flex: 1;

    min-width: 0;
}

.search button {
    margin: 0;
}


/* =========================================================
   GENERAL LAYOUT
   ========================================================= */

.titleline,
.result {
    display: flex;

    justify-content: space-between;

    align-items: flex-start;

    gap: 16px;
}


/* =========================================================
   BADGES
   ========================================================= */

.badge {
    display: inline-block;

    background: #e8edf2;

    border-radius: 999px;

    padding: 4px 9px;

    font-size: 12px;

    font-weight: 700;
}

.okbg {
    background: #d8f3df;
    color: #17652b;
}

.badbg {
    background: #fde0e0;
    color: #8a1f1f;
}

.warn {
    background: #fff1c7;
    color: #775400;
}

.ok {
    color: #19733a;
}

.bad {
    color: #a11;
}


/* =========================================================
   TEXT HELPERS
   ========================================================= */

.muted {
    color: #66788a;
}

.small {
    font-size: 13px;

    word-break: break-all;
}

.help {
    font-size: 13px;

    color: #66788a;

    margin: 6px 0;
}


/* =========================================================
   INCIDENTS
   ========================================================= */

.incident {
    border-top: 1px solid #e5e9ed;

    padding: 10px 0;
}

.voided {
    opacity: .55;
}


/* =========================================================
   CHECKBOX
   ========================================================= */

.check {
    display: flex;

    gap: 9px;

    align-items: center;

    margin: 16px 0;
}

.check input {
    width: auto;

    margin: 0;
}

.check + button {
    margin-top: 2px;
}


/* =========================================================
   NOTICES
   ========================================================= */

.notice {
    padding: 11px 13px;

    border-radius: 8px;

    margin: 12px 0;
}

.oknotice {
    background: #d8f3df;
    color: #17652b;
}

.errornotice {
    background: #fde0e0;
    color: #8a1f1f;
}


/* =========================================================
   IMAGE PREVIEW
   ========================================================= */

.preview {
    margin-top: 22px;
}

.preview img {
    display: block;

    max-width: 100%;

    max-height: 360px;

    margin-top: 8px;

    border-radius: 10px;

    border: 1px solid #dbe2e8;
}


/* =========================================================
   TABLES
   ========================================================= */

table {
    width: 100%;

    max-width: 100%;

    border-collapse: collapse;
}

.tablewrap {
    width: 100%;

    overflow-x: auto;

    -webkit-overflow-scrolling: touch;
}


/* =========================================================
   IMAGES / MEDIA
   ========================================================= */

img,
video {
    max-width: 100%;
    height: auto;
}


/* =========================================================
   NFC / SCAN LAYOUT SAFETY
   ========================================================= */

.nfc-create {
    display: grid;

    grid-template-columns: 1fr auto;

    gap: 10px;

    margin: 18px 0;

    width: 100%;
}

.nfc-create button {
    margin: 0;
}

.tokenbox {
    font: 12px monospace;

    word-break: break-all;
}

.scanrow {
    display: grid;

    grid-template-columns: 1fr auto auto;

    gap: 8px;

    width: 100%;
}

.scanrow button {
    margin: 0;
}

.verify-card {
    margin-top: 22px;

    padding: 18px;

    border: 1px solid #dbe2e8;

    border-radius: 12px;

    background: #f8fafc;
}

.scan-summary {
    display: grid;

    grid-template-columns:
        repeat(4, minmax(0, 1fr));

    gap: 12px;

    margin: 22px 0;

    width: 100%;
}

.scan-summary > div {
    min-width: 0;

    padding: 14px;

    background: #f7f9fb;

    border-radius: 10px;
}

.scan-summary span {
    display: block;

    font-size: 12px;

    color: #66788a;

    margin-bottom: 6px;
}

.scan-summary b {
    display: block;

    font-size: 18px;

    overflow-wrap: anywhere;
}


/* =========================================================
   INFRACTION PHOTOS
   ========================================================= */

.infraction-photos {
    display: flex;

    flex-wrap: wrap;

    gap: 8px;

    margin-top: 8px;
}

.infraction-photos a {
    display: block;

    max-width: 100%;
}

.infraction-photos img {
    display: block;

    width: 110px;
    height: 80px;

    max-width: 100%;

    object-fit: cover;

    border-radius: 7px;

    border: 1px solid #dbe2e8;
}


/* =========================================================
   TABLET / MOBILE
   ========================================================= */

@media (max-width: 760px) {

    html,
    body {
        width: 100%;
        max-width: 100%;

        margin: 0;

        overflow-x: hidden;
    }


    /* Main container */

    .wrap {
        width: 100%;
        max-width: 100%;

        margin: 10px auto;

        padding: 0 10px;
    }


    /* Header */

    .topbar {
        width: 100%;
        max-width: 100%;

        display: flex;

        align-items: center;

        flex-wrap: nowrap;

        gap: 8px;

        padding: 10px;
    }


    /* Brand */

    .brand {
        width: auto;

        min-width: 0;

        flex: 1;

        gap: 8px;
    }

    .brandtext {
        min-width: 0;

        overflow: hidden;

        text-overflow: ellipsis;

        white-space: nowrap;
    }


    /* Hide desktop menu */

    .navlinks {
        display: none !important;
    }

    .userpill {
        display: none !important;
    }

    .logoutbtn {
        display: none !important;
    }


    /* Right side controls */

    .account {
        margin-left: auto;

        flex: none;

        display: flex;

        align-items: center;

        gap: 7px;
    }


    /* Notification bell */

    .notificationbell,
    .notificationbell:link,
    .notificationbell:visited {
        width: 40px;

        height: 40px;

        flex-shrink: 0;
    }


    /* Hamburger */

    .mobilemenubtn {
        display: flex;

        flex-direction: column;

        align-items: center;

        justify-content: center;

        gap: 4px;

        width: 40px;

        height: 40px;

        min-width: 40px;

        padding: 0;

        margin: 0;

        border: 0;

        border-radius: 9px;

        background: #174a7e;

        cursor: pointer;

        flex-shrink: 0;
    }

    .mobilemenubtn span {
        display: block;

        width: 19px;

        height: 2px;

        border-radius: 2px;

        background: #fff;

        transition:
            transform .18s ease,
            opacity .18s ease;
    }

    .mobilemenubtn.open span:nth-child(1) {
        transform:
            translateY(6px)
            rotate(45deg);
    }

    .mobilemenubtn.open span:nth-child(2) {
        opacity: 0;
    }

    .mobilemenubtn.open span:nth-child(3) {
        transform:
            translateY(-6px)
            rotate(-45deg);
    }


/* Mobile dropdown */

.mobilemenu {
    display: none;

    width: 100%;
    max-width: 100%;

    margin: -12px 0 18px;
    padding: 10px;

    position: relative;
    z-index: 1000;

    background: #fff;

    border: 1px solid #dbe2e8;
    border-radius: 12px;

    box-shadow: 0 10px 30px #00000024;
}

.mobilemenu.open {
    display: block;
}


    /* Mobile account information */

    .mobilemenu-user {
        display: flex;

        align-items: center;

        justify-content: space-between;

        gap: 10px;

        padding: 8px 10px 12px;

        margin-bottom: 5px;

        border-bottom: 1px solid #e5e9ed;
    }

    .mobilemenu-username {
        min-width: 0;

        overflow: hidden;

        text-overflow: ellipsis;

        white-space: nowrap;

        font-weight: 700;
    }

    .mobilemenu-role {
        flex-shrink: 0;

        font-size: 11px;

        font-weight: 700;

        text-transform: uppercase;

        letter-spacing: .4px;

        padding: 4px 8px;

        border-radius: 999px;

        background: #dceaf7;

        color: #174a7e;
    }


    /* Mobile menu links */

    .mobilemenu a {
        display: flex;

        align-items: center;

        width: 100%;

        min-height: 44px;

        padding: 10px 12px;

        margin: 2px 0;

        border-radius: 8px;

        color: #174a7e;

        text-decoration: none;

        font-weight: 700;
    }

    .mobilemenu a:hover {
        background: #edf4fb;
    }

    .mobilemenu .mobilelogout {
        margin-top: 7px;

        border-top: 1px solid #e5e9ed;

        border-radius: 0;

        color: #9b2c2c;
    }

    .mobile-notification-count {
        display: inline-flex;

        align-items: center;

        justify-content: center;

        min-width: 21px;

        height: 21px;

        margin-left: auto;

        padding: 0 6px;

        border-radius: 999px;

        background: #b02a2a;

        color: #fff;

        font-size: 11px;

        font-weight: 700;
    }


    /* Cards */

    .card {
        width: 100%;

        max-width: 100%;

        padding: 17px;

        overflow: hidden;
    }


    /* Page layouts */

    .search,
    .titleline,
    .result {
        display: block;

        width: 100%;
    }

    .search button {
        margin-top: 10px;

        width: 100%;
    }


    /* Headings */

    h1 {
        font-size: 25px;
    }


    /* Grids */

    .grid {
        grid-template-columns: 1fr;

        gap: 12px;
    }


    /* NFC summary */

    .scan-summary {
        grid-template-columns:
            repeat(2, minmax(0, 1fr));

        gap: 10px;

        width: 100%;
    }

    .scan-summary > div {
        min-width: 0;
    }

    .scan-summary b {
        font-size: 17px;

        overflow-wrap: anywhere;
    }


    /* NFC forms */

    .nfc-create,
    .scanrow {
        grid-template-columns: 1fr;
    }

    .scanrow button,
    .nfc-create button {
        width: 100%;
    }


    /* Infraction photos */

    .infraction-photos {
        width: 100%;

        gap: 7px;
    }

    .infraction-photos img {
        width: 105px;

        height: 76px;
    }

}


/* =========================================================
   SMALL PHONES
   ========================================================= */

@media (max-width: 420px) {

    .wrap {
        padding: 0 8px;
    }

    .topbar {
        padding: 8px;

        gap: 6px;
    }

    .brand {
        gap: 7px;
    }

    .brandmark {
        width: 32px;

        height: 32px;
    }

    .brandtext {
        font-size: 15px;
    }

    .notificationbell,
    .notificationbell:link,
    .notificationbell:visited,
    .mobilemenubtn {
        width: 36px;

        min-width: 36px;

        height: 36px;
    }

    .card {
        padding: 14px;
    }

    h1 {
        font-size: 24px;
    }

    .scan-summary {
        grid-template-columns: 1fr;
    }

    .infraction-photos img {
        width: 96px;

        height: 70px;
    }

}


/* =========================================================
   VERY SMALL PHONES
   ========================================================= */

@media (max-width: 340px) {

    .brandtext {
        font-size: 14px;
    }

    .notificationbell {
        display: none !important;
    }

    .card {
        padding: 12px;
    }

}

/* =========================================================
   DESKTOP WIDTH / RESPONSIVE FIXES
   ========================================================= */

/*
 * TOP NAVIGATION
 * Allow the navigation area to use available space properly.
 */

.topbar {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: nowrap;
}

.brand {
    flex: 0 0 auto;
}

.navlinks {
    display: flex;
    align-items: center;
    gap: 6px;
    flex: 1 1 auto;
    min-width: 0;
    flex-wrap: nowrap;
}

.navbtn {
    flex: 0 1 auto;
    white-space: nowrap;
    padding-left: 11px;
    padding-right: 11px;
}

.account {
    display: flex;
    align-items: center;
    gap: 7px;
    flex: 0 0 auto;
    margin-left: auto;
    min-width: 0;
}

.userpill {
    min-width: 0;
    max-width: 190px;
}

.userpill > span:first-child {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}


/* =========================================================
   INFRACTIONS FILTER
   ========================================================= */

/*
 * Prevent any filter control from forcing its grid column
 * wider than the filter container.
 */

.infraction-filters,
.filter-grid {
    width: 100%;
    min-width: 0;
}

.infraction-filters *,
.filter-grid * {
    min-width: 0;
}

.infraction-filters input,
.infraction-filters select,
.filter-grid input,
.filter-grid select {
    width: 100%;
    max-width: 100%;
}


/* =========================================================
   TABLET / SMALL DESKTOP
   ========================================================= */

@media (max-width: 1100px) {

    .topbar {
        gap: 7px;
    }

    .brandtext {
        font-size: 15px;
    }

    .navlinks {
        gap: 4px;
    }

    .navbtn {
        padding: 8px 9px;
        font-size: 14px;
    }

    .notificationbell {
        width: 38px;
        height: 38px;
    }

    .userpill {
        max-width: 150px;
        padding-left: 8px;
        padding-right: 8px;
    }

    .logoutbtn {
        padding-left: 11px;
        padding-right: 11px;
    }
}


/* =========================================================
   MOBILE NAVIGATION
   Existing hamburger menu takes over.
   ========================================================= */

@media (max-width: 760px) {

    .navlinks {
        display: none;
    }

    .notificationbell,
    .userpill,
    .logoutbtn {
        display: none;
    }

    .mobilemenubtn {
        display: inline-flex;
    }
}
/* =========================================================
   COMPACT DESKTOP HEADER
   ========================================================= */

@media (min-width:761px) {
    .topbar {
        gap: 10px;
        padding: 10px 12px;
    }

    .brand {
        gap: 8px;
        font-size: 16px;
        flex: 0 0 auto;
    }

    .brandmark {
        width: 34px;
        height: 34px;
        flex: 0 0 34px;
    }

    .navlinks {
        display: flex;
        align-items: center;
        gap: 6px;
        flex: 1 1 auto;
        min-width: 0;
        flex-wrap: nowrap;
    }

    .navbtn {
        flex: 0 0 auto;
        padding: 8px 10px;
        min-height: 38px;
        font-size: 15px;
        white-space: nowrap;
    }

    .account {
        display: flex;
        align-items: center;
        gap: 8px;
        margin-left: auto;
        flex: 0 1 auto;
        min-width: 0;
    }

    .notificationbell,
    .notificationbell:link,
    .notificationbell:visited {
        width: 42px;
        height: 42px;
        flex: 0 0 42px;
        margin: 0;
    }

    .userpill {
        min-width: 0;
        max-width: 145px;
        padding: 7px 9px;
        gap: 6px;
        overflow: hidden;
    }

    .userpill b {
        flex: 0 0 auto;
    }

    .logoutbtn {
        flex: 0 0 auto;
        padding: 8px 12px;
        min-height: 38px;
    }

    .mobilemenubtn {
        display: none;
    }
}
/* =========================================================
   PARKING SYSTEM LOGO
   ========================================================= */

.brandlogo {
    display: block;
    width: 42px;
    height: 42px;
    object-fit: contain;
    flex: 0 0 42px;
}

/* Keep logo/header compact on phones */
@media (max-width: 760px) {

    .brandlogo {
        width: 36px;
        height: 36px;
        flex-basis: 36px;
    }
}

@media (max-width: 480px) {

    .brandlogo {
        width: 34px;
        height: 34px;
        flex-basis: 34px;
    }
}