﻿:root {
    --green-950: #052e16;
    --green-900: #14532d;
    --green-800: #166534;
    --green-700: #15803d;
    --green-600: #16a34a;
    --green-500: #22c55e;
    --green-200: #bbf7d0;
    --green-100: #dcfce7;
    --green-50: #f0fdf4;

    --purple-700: #6d28d9;
    --purple-100: #ede9fe;

    --red-700: #b91c1c;
    --red-100: #fee2e2;

    --orange-700: #b45309;
    --orange-100: #fef3c7;

    --blue-700: #0369a1;
    --blue-100: #e0f2fe;

    --bg: #f3f7f4;
    --surface: #ffffff;
    --surface-soft: #f8faf9;

    --text: #17211b;
    --text-soft: #5f6f65;
    --text-muted: #849188;

    --border: #dce6df;
    --border-dark: #cbd8cf;

    --shadow-sm:
        0 2px 6px rgba(10, 40, 20, 0.05);

    --shadow-md:
        0 12px 32px rgba(10, 40, 20, 0.08);

    --shadow-lg:
        0 24px 60px rgba(5, 46, 22, 0.14);

    --radius-sm: 10px;
    --radius: 16px;
    --radius-lg: 24px;

    --container: 1220px;
}


/* ================================================================
   RESET
================================================================ */

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    min-height: 100vh;

    font-family:
        Inter,
        ui-sans-serif,
        system-ui,
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        sans-serif;

    color: var(--text);

    background:
        radial-gradient(
            circle at 5% 0%,
            rgba(34, 197, 94, 0.08),
            transparent 28%
        ),
        radial-gradient(
            circle at 100% 8%,
            rgba(109, 40, 217, 0.05),
            transparent 25%
        ),
        var(--bg);
}

body.menu-open {
    overflow: hidden;
}

a {
    color: inherit;
}

img {
    display: block;
    max-width: 100%;
}

button,
input,
textarea,
select {
    font: inherit;
}


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

.site-header {
    position: sticky;
    top: 0;
    z-index: 1000;

    background:
        rgba(5, 46, 22, 0.97);

    border-bottom:
        1px solid rgba(255, 255, 255, 0.08);

    backdrop-filter: blur(14px);
}

.navbar {
    width:
        min(
            calc(100% - 40px),
            var(--container)
        );

    min-height: 72px;

    margin: 0 auto;

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

    gap: 24px;
}

.brand {
    min-width: 0;

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

    gap: 11px;

    color: white;
    text-decoration: none;
}

.brand-mark {
    width: 42px;
    height: 42px;

    flex: 0 0 42px;

    display: grid;
    place-items: center;

    border-radius: 13px;

    background:
        linear-gradient(
            135deg,
            #86efac,
            #22c55e
        );

    color: var(--green-950);

    font-size: 13px;
    font-weight: 900;
}

.brand-text {
    min-width: 0;

    display: flex;
    flex-direction: column;
}

.brand-title {
    color: white;

    font-size: 16px;
    font-weight: 800;

    line-height: 1.1;
}

.brand-subtitle {
    margin-top: 4px;

    color: #bbf7d0;

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

    letter-spacing: 1.1px;

    text-transform: uppercase;
}

.nav-links {
    display: flex;
    align-items: center;

    gap: 4px;
}

.nav-link {
    min-height: 42px;

    padding:
        0 13px;

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

    border-radius: 10px;

    color: #dcfce7;

    text-decoration: none;

    font-size: 14px;
    font-weight: 650;

    transition:
        background 0.2s ease,
        color 0.2s ease;
}

.nav-link:hover,
.nav-link.active {
    color: white;

    background:
        rgba(255, 255, 255, 0.10);
}

.nav-user {
    margin-left: 8px;

    padding-left: 14px;

    display: flex;
    align-items: center;

    gap: 8px;

    border-left:
        1px solid rgba(255, 255, 255, 0.12);
}

.nav-avatar {
    width: 36px;
    height: 36px;

    overflow: hidden;

    display: grid;
    place-items: center;

    border-radius: 50%;

    background: var(--green-100);

    color: var(--green-900);

    font-size: 13px;
    font-weight: 900;
}

.nav-avatar img {
    width: 100%;
    height: 100%;

    object-fit: cover;
}

.logout-form {
    margin: 0;
}

.logout-button {
    min-height: 40px;

    padding:
        0 12px;

    border: 0;

    border-radius: 10px;

    background: transparent;

    color: #fecaca;

    cursor: pointer;

    font-size: 14px;
    font-weight: 650;
}

.logout-button:hover {
    background:
        rgba(239, 68, 68, 0.12);
}

.mobile-menu-button {
    display: none;

    min-width: 72px;
    height: 42px;

    padding:
        0 12px;

    border:
        1px solid rgba(255, 255, 255, 0.14);

    border-radius: 10px;

    background:
        rgba(255, 255, 255, 0.08);

    color: white;

    cursor: pointer;

    font-size: 13px;
    font-weight: 800;
}


/* ================================================================
   PAGE LAYOUT
================================================================ */

.page-shell {
    width:
        min(
            calc(100% - 40px),
            var(--container)
        );

    margin: 0 auto;

    padding:
        36px 0 58px;
}

.page-header {
    margin-bottom: 24px;

    display: flex;
    align-items: flex-end;
    justify-content: space-between;

    gap: 20px;
}

.page-title {
    margin: 0;

    color: var(--text);

    font-size:
        clamp(
            27px,
            4vw,
            39px
        );

    font-weight: 850;

    line-height: 1.08;

    letter-spacing: -1.2px;
}

.page-subtitle {
    max-width: 720px;

    margin:
        9px 0 0;

    color: var(--text-soft);

    font-size: 15px;

    line-height: 1.65;
}


/* ================================================================
   PANELS
================================================================ */

.panel {
    border:
        1px solid var(--border);

    border-radius: var(--radius);

    background:
        rgba(255, 255, 255, 0.96);

    box-shadow:
        var(--shadow-sm);
}

.panel-padding {
    padding: 25px;
}

.panel-title {
    margin:
        0 0 5px;

    color: var(--text);

    font-size: 19px;
    font-weight: 800;

    letter-spacing: -0.3px;
}

.panel-description {
    margin:
        0 0 21px;

    color: var(--text-soft);

    font-size: 14px;

    line-height: 1.6;
}


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

.btn {
    min-height: 44px;

    padding:
        0 17px;

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

    gap: 7px;

    border:
        1px solid transparent;

    border-radius: 11px;

    text-decoration: none;

    cursor: pointer;

    font-size: 14px;
    font-weight: 750;

    transition:
        transform 0.15s ease,
        box-shadow 0.15s ease,
        background 0.15s ease;
}

.btn:hover {
    transform:
        translateY(-1px);
}

.btn-primary {
    color: white;

    background:
        linear-gradient(
            135deg,
            var(--green-800),
            var(--green-600)
        );

    box-shadow:
        0 8px 20px
        rgba(22, 101, 52, 0.18);
}

.btn-primary:hover {
    background:
        linear-gradient(
            135deg,
            var(--green-900),
            var(--green-700)
        );
}

.btn-secondary {
    color: var(--text);

    background: white;

    border-color:
        var(--border-dark);
}

.btn-soft {
    color: var(--green-900);

    background:
        var(--green-100);
}

.btn-danger {
    color: #991b1b;

    background:
        var(--red-100);
}

.btn-full {
    width: 100%;
}


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

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

.form-label {
    display: block;

    margin-bottom: 7px;

    color: #35433a;

    font-size: 13px;
    font-weight: 750;
}

input,
textarea,
select {
    width: 100%;

    border:
        1px solid var(--border-dark);

    border-radius: 11px;

    outline: none;

    background: white;

    color: var(--text);

    padding:
        11px 13px;

    transition:
        border-color 0.2s ease,
        box-shadow 0.2s ease;
}

input {
    min-height: 46px;
}

textarea {
    min-height: 110px;

    resize: vertical;
}

select {
    min-height: 46px;
}

input:focus,
textarea:focus,
select:focus {
    border-color:
        var(--green-500);

    box-shadow:
        0 0 0 4px
        rgba(34, 197, 94, 0.11);
}

input[type="file"] {
    padding: 9px;
}

.helptext {
    display: block;

    margin:
        -8px 0 15px;

    color: var(--text-muted);

    font-size: 12px;

    line-height: 1.5;
}

.helptext ul {
    margin:
        8px 0 0;

    padding-left: 18px;
}

ul.errorlist {
    margin:
        6px 0 10px;

    padding-left: 18px;

    color: var(--red-700);

    font-size: 13px;
}


/* ================================================================
   DJANGO MESSAGES
================================================================ */

.messages {
    margin-bottom: 20px;
}

.alert {
    padding:
        13px 15px;

    border:
        1px solid #bbf7d0;

    border-radius: 11px;

    background: var(--green-50);

    color: var(--green-900);

    font-size: 14px;

    line-height: 1.5;
}

.alert-error {
    border-color: #fecaca;

    background: #fef2f2;

    color: #991b1b;
}


/* ================================================================
   AUTH PAGES
================================================================ */

.auth-layout {
    min-height:
        calc(100vh - 190px);

    display: grid;

    grid-template-columns:
        minmax(0, 1.05fr)
        minmax(390px, 0.72fr);

    gap: 26px;

    align-items: stretch;
}

.auth-visual {
    position: relative;

    overflow: hidden;

    min-height: 580px;

    padding: 46px;

    border-radius: var(--radius-lg);

    background:
        linear-gradient(
            145deg,
            #052e16,
            #14532d 56%,
            #166534
        );

    color: white;

    box-shadow:
        var(--shadow-lg);
}

.auth-visual::before {
    content: "";

    position: absolute;

    width: 420px;
    height: 420px;

    right: -150px;
    top: -170px;

    border-radius: 50%;

    background:
        rgba(134, 239, 172, 0.13);
}

.auth-visual::after {
    content: "";

    position: absolute;

    width: 280px;
    height: 280px;

    left: -100px;
    bottom: -120px;

    border-radius: 50%;

    background:
        rgba(196, 181, 253, 0.10);
}

.auth-visual-content {
    position: relative;
    z-index: 2;

    max-width: 570px;
}

.auth-badge {
    display: inline-flex;

    padding:
        7px 11px;

    border:
        1px solid rgba(255, 255, 255, 0.15);

    border-radius: 100px;

    background:
        rgba(255, 255, 255, 0.08);

    color: #dcfce7;

    font-size: 12px;
    font-weight: 700;
}

.auth-heading {
    max-width: 600px;

    margin:
        27px 0 0;

    font-size:
        clamp(
            37px,
            5vw,
            58px
        );

    font-weight: 900;

    line-height: 1.02;

    letter-spacing: -2px;
}

.auth-description {
    max-width: 530px;

    margin:
        21px 0 0;

    color: #d1fae5;

    font-size: 16px;

    line-height: 1.7;
}

.auth-features {
    margin-top: 39px;

    display: grid;

    gap: 14px;
}

.auth-feature {
    display: flex;
    align-items: center;

    gap: 11px;

    color: #ecfdf5;

    font-size: 14px;
}

.auth-feature-dot {
    width: 25px;
    height: 25px;

    flex:
        0 0 25px;

    display: grid;
    place-items: center;

    border-radius: 50%;

    background:
        rgba(134, 239, 172, 0.17);

    color: #86efac;

    font-size: 12px;
    font-weight: 900;
}

.auth-card {
    align-self: center;

    padding: 36px;

    border:
        1px solid var(--border);

    border-radius: var(--radius-lg);

    background: white;

    box-shadow:
        var(--shadow-md);
}

.auth-card h1 {
    margin:
        0 0 8px;

    font-size: 30px;
    font-weight: 850;

    letter-spacing: -0.8px;
}

.auth-card-subtitle {
    margin:
        0 0 28px;

    color: var(--text-soft);

    font-size: 14px;

    line-height: 1.6;
}

.auth-switch {
    margin:
        23px 0 0;

    text-align: center;

    color: var(--text-soft);

    font-size: 14px;
}

.auth-switch a {
    color: var(--green-800);

    font-weight: 800;

    text-decoration: none;
}


/* ================================================================
   DASHBOARD HERO
================================================================ */

.dashboard-hero {
    position: relative;

    overflow: hidden;

    margin-bottom: 24px;

    padding: 32px;

    border-radius: var(--radius-lg);

    color: white;

    background:
        linear-gradient(
            135deg,
            #052e16,
            #14532d 58%,
            #166534
        );

    box-shadow:
        var(--shadow-md);
}

.dashboard-hero::after {
    content: "";

    position: absolute;

    width: 330px;
    height: 330px;

    right: -80px;
    top: -160px;

    border-radius: 50%;

    background:
        rgba(134, 239, 172, 0.12);
}

.dashboard-hero-content {
    position: relative;
    z-index: 2;
}

.dashboard-kicker {
    color: #86efac;

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

    letter-spacing: 1.3px;

    text-transform: uppercase;
}

.dashboard-hero h1 {
    margin:
        7px 0 8px;

    font-size:
        clamp(
            29px,
            4vw,
            42px
        );

    font-weight: 900;

    letter-spacing: -1.3px;
}

.dashboard-hero p {
    max-width: 660px;

    margin: 0;

    color: #d1fae5;

    font-size: 15px;

    line-height: 1.6;
}


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

.kpi-grid {
    display: grid;

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

    gap: 15px;

    margin-bottom: 24px;
}

.kpi-card {
    min-width: 0;

    padding: 21px;

    border:
        1px solid var(--border);

    border-radius: var(--radius);

    background: white;

    box-shadow:
        var(--shadow-sm);
}

.kpi-icon {
    width: 41px;
    height: 41px;

    margin-bottom: 17px;

    display: grid;
    place-items: center;

    border-radius: 12px;

    background:
        var(--green-100);

    color: var(--green-900);

    font-size: 14px;
    font-weight: 900;
}

.kpi-label {
    color: var(--text-soft);

    font-size: 13px;
    font-weight: 650;
}

.kpi-value {
    margin-top: 5px;

    color: var(--text);

    font-size: 31px;
    font-weight: 900;

    line-height: 1.1;

    letter-spacing: -1px;
}

.kpi-foot {
    margin-top: 7px;

    color: var(--text-muted);

    font-size: 12px;

    line-height: 1.4;
}


/* ================================================================
   DASHBOARD CONTENT
================================================================ */

.dashboard-grid {
    display: grid;

    grid-template-columns:
        minmax(0, 1.25fr)
        minmax(290px, 0.7fr);

    gap: 18px;

    margin-bottom: 24px;
}

.quality-list {
    display: grid;

    gap: 18px;
}

.quality-item-header {
    margin-bottom: 8px;

    display: flex;
    justify-content: space-between;

    gap: 15px;

    font-size: 13px;
}

.quality-name {
    font-weight: 750;
}

.quality-value {
    color: var(--text-soft);
}

.progress-track {
    height: 9px;

    overflow: hidden;

    border-radius: 100px;

    background: #edf2ee;
}

.progress-bar {
    height: 100%;

    border-radius: 100px;

    background:
        linear-gradient(
            90deg,
            #15803d,
            #4ade80
        );
}

.progress-damage {
    background:
        linear-gradient(
            90deg,
            #b45309,
            #f59e0b
        );
}

.progress-rotten {
    background:
        linear-gradient(
            90deg,
            #b91c1c,
            #ef4444
        );
}

.progress-sprouted {
    background:
        linear-gradient(
            90deg,
            #6d28d9,
            #a78bfa
        );
}


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

.table-wrapper {
    width: 100%;

    overflow-x: auto;
}

.data-table {
    width: 100%;

    border-collapse: collapse;
}

.data-table th {
    padding:
        12px 13px;

    border-bottom:
        1px solid var(--border);

    color: var(--text-muted);

    text-align: left;

    white-space: nowrap;

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

    letter-spacing: 0.5px;

    text-transform: uppercase;
}

.data-table td {
    padding:
        15px 13px;

    border-bottom:
        1px solid #edf1ee;

    color: var(--text);

    font-size: 14px;

    vertical-align: middle;
}

.data-table tbody tr:last-child td {
    border-bottom: 0;
}

.data-table tbody tr:hover {
    background: #fafcfb;
}

.table-id {
    color: var(--green-900);

    font-family:
        ui-monospace,
        SFMono-Regular,
        Menlo,
        Consolas,
        monospace;

    font-weight: 750;
}


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

.badge {
    min-height: 26px;

    padding:
        0 9px;

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

    border-radius: 100px;

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

    white-space: nowrap;
}

.badge-success {
    color: #166534;

    background:
        var(--green-100);
}

.badge-warning {
    color: #92400e;

    background:
        var(--orange-100);
}

.badge-danger {
    color: #991b1b;

    background:
        var(--red-100);
}

.badge-info {
    color: #075985;

    background:
        var(--blue-100);
}

.badge-neutral {
    color: #475569;

    background: #f1f5f9;
}


/* ================================================================
   MOBILE HISTORY / INSPECTION CARDS
================================================================ */

.mobile-records {
    display: none;
}

.mobile-record {
    padding: 18px;

    border:
        1px solid var(--border);

    border-radius: 14px;

    background: white;
}

.mobile-record + .mobile-record {
    margin-top: 12px;
}

.mobile-record-top {
    margin-bottom: 14px;

    display: flex;
    justify-content: space-between;
    align-items: flex-start;

    gap: 14px;
}

.mobile-record-title {
    font-size: 15px;
    font-weight: 850;
}

.mobile-record-date {
    margin-top: 3px;

    color: var(--text-muted);

    font-size: 12px;
}

.mobile-record-grid {
    margin-bottom: 15px;

    display: grid;

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

    gap: 12px;
}

.mobile-record-label {
    color: var(--text-muted);

    font-size: 10px;
    font-weight: 750;

    letter-spacing: 0.5px;

    text-transform: uppercase;
}

.mobile-record-value {
    margin-top: 3px;

    font-size: 14px;
    font-weight: 750;
}


/* ================================================================
   EMPTY STATE
================================================================ */

.empty-state {
    padding:
        48px 20px;

    text-align: center;
}

.empty-icon {
    width: 62px;
    height: 62px;

    margin:
        0 auto 17px;

    display: grid;
    place-items: center;

    border-radius: 18px;

    background:
        var(--green-100);

    color: var(--green-900);

    font-size: 18px;
    font-weight: 900;
}

.empty-state h3 {
    margin:
        0 0 8px;

    font-size: 20px;
    font-weight: 800;
}

.empty-state p {
    max-width: 480px;

    margin:
        0 auto;

    color: var(--text-soft);

    font-size: 14px;

    line-height: 1.6;
}


/* ================================================================
   PROFILE
================================================================ */

.profile-layout {
    display: grid;

    grid-template-columns:
        300px
        minmax(0, 1fr);

    gap: 20px;
}

.profile-card {
    padding: 28px;

    text-align: center;
}

.profile-avatar-large {
    width: 112px;
    height: 112px;

    margin:
        0 auto 18px;

    overflow: hidden;

    display: grid;
    place-items: center;

    border:
        5px solid #ecfdf5;

    border-radius: 50%;

    background:
        linear-gradient(
            135deg,
            #bbf7d0,
            #dcfce7
        );

    color: var(--green-900);

    font-size: 30px;
    font-weight: 900;
}

.profile-avatar-large img {
    width: 100%;
    height: 100%;

    object-fit: cover;
}

.profile-name {
    margin: 0;

    font-size: 21px;
    font-weight: 850;
}

.profile-username {
    margin-top: 5px;

    color: var(--text-soft);

    font-size: 13px;
}

.profile-meta {
    margin-top: 24px;

    padding-top: 19px;

    border-top:
        1px solid var(--border);

    text-align: left;
}

.profile-meta-row {
    margin-bottom: 14px;
}

.profile-meta-label {
    color: var(--text-muted);

    font-size: 10px;
    font-weight: 750;

    letter-spacing: 0.5px;

    text-transform: uppercase;
}

.profile-meta-value {
    margin-top: 4px;

    color: var(--text);

    font-size: 14px;
    font-weight: 650;

    word-break: break-word;
}

.form-grid {
    display: grid;

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

    column-gap: 17px;
}

.form-span-2 {
    grid-column:
        1 / -1;
}


/* ================================================================
   INSPECTION DETAIL
================================================================ */

.result-hero {
    margin-bottom: 20px;

    padding: 26px;

    border:
        1px solid var(--border);

    border-radius: var(--radius-lg);

    background:
        linear-gradient(
            145deg,
            #ffffff,
            #f5faf6
        );

    box-shadow:
        var(--shadow-sm);
}

.result-hero-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;

    gap: 20px;
}

.result-id {
    margin-top: 8px;

    color: var(--text-soft);

    font-family:
        ui-monospace,
        SFMono-Regular,
        Menlo,
        Consolas,
        monospace;

    font-size: 13px;

    word-break: break-all;
}

.info-grid {
    display: grid;

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

    gap: 14px;
}

.info-box {
    min-width: 0;

    padding: 16px;

    border:
        1px solid var(--border);

    border-radius: 12px;

    background:
        var(--surface-soft);
}

.info-label {
    color: var(--text-muted);

    font-size: 10px;
    font-weight: 750;

    letter-spacing: 0.45px;

    text-transform: uppercase;
}

.info-value {
    margin-top: 5px;

    color: var(--text);

    font-size: 14px;
    font-weight: 750;

    word-break: break-word;
}

.result-actions {
    display: flex;
    flex-wrap: wrap;

    gap: 10px;

    margin-top: 18px;
}


/* ================================================================
   PAGINATION
================================================================ */

.pagination {
    margin-top: 22px;

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

    gap: 12px;
}

.pagination-current {
    color: var(--text-soft);

    font-size: 13px;
}


/* ================================================================
   FOOTER
================================================================ */

.site-footer {
    width:
        min(
            calc(100% - 40px),
            var(--container)
        );

    margin:
        0 auto;

    padding:
        25px 0 34px;

    display: flex;
    justify-content: space-between;

    gap: 20px;

    border-top:
        1px solid var(--border);

    color: var(--text-muted);

    font-size: 12px;
}


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

@media (max-width: 980px) {

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

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

    .profile-layout {
        grid-template-columns:
            1fr;
    }

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

    .auth-layout {
        grid-template-columns:
            1fr;
    }

    .auth-visual {
        min-height: auto;
    }
}


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

@media (max-width: 760px) {

    .navbar {
        position: relative;

        width:
            calc(100% - 28px);

        min-height: 64px;
    }

    .brand-mark {
        width: 38px;
        height: 38px;

        flex-basis: 38px;
    }

    .brand-subtitle {
        display: none;
    }

    .mobile-menu-button {
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    .nav-links {
        position: absolute;

        top: 58px;
        left: 0;
        right: 0;

        display: none;

        padding: 11px;

        flex-direction: column;
        align-items: stretch;

        gap: 4px;

        border:
            1px solid rgba(255, 255, 255, 0.10);

        border-radius: 14px;

        background: var(--green-950);

        box-shadow:
            var(--shadow-lg);
    }

    .nav-links.nav-open {
        display: flex;
    }

    .nav-link {
        width: 100%;

        justify-content: flex-start;

        padding:
            0 13px;
    }

    .nav-user {
        width: 100%;

        margin:
            5px 0 0;

        padding:
            10px 0 0;

        border-left: 0;

        border-top:
            1px solid rgba(255, 255, 255, 0.10);
    }

    .logout-form {
        flex: 1;
    }

    .logout-button {
        width: 100%;

        padding:
            0 13px;

        text-align: left;
    }


    .page-shell {
        width:
            calc(100% - 28px);

        padding:
            23px 0 42px;
    }

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

    .panel-padding {
        padding: 18px;
    }


    .auth-layout {
        min-height:
            calc(100vh - 150px);

        display: flex;
        align-items: center;
    }

    .auth-visual {
        display: none;
    }

    .auth-card {
        width: 100%;

        padding:
            25px 20px;
    }


    .dashboard-hero {
        padding:
            24px 20px;
    }

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

    .kpi-card {
        padding: 18px;
    }


    .desktop-table {
        display: none;
    }

    .mobile-records {
        display: block;
    }


    .profile-card {
        text-align: left;
    }

    .profile-avatar-large {
        margin:
            0 0 18px;
    }

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

    .form-span-2 {
        grid-column: auto;
    }


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

    .result-hero-top {
        flex-direction: column;
    }

    .result-actions {
        display: grid;

        grid-template-columns:
            1fr;
    }

    .result-actions .btn {
        width: 100%;
    }


    .pagination {
        flex-wrap: wrap;
    }


    .site-footer {
        width:
            calc(100% - 28px);

        flex-direction: column;

        gap: 5px;
    }
}


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

@media (max-width: 390px) {

    .navbar,
    .page-shell,
    .site-footer {
        width:
            calc(100% - 20px);
    }

    .brand-title {
        font-size: 14px;
    }

    .mobile-menu-button {
        min-width: 64px;

        padding:
            0 9px;
    }

    .mobile-record-grid {
        grid-template-columns:
            1fr;
    }

    .dashboard-hero h1 {
        font-size: 27px;
    }

    .auth-card h1 {
        font-size: 27px;
    }
}

/* ================================================================
   FINAL RESPONSIVE / NAVBAR FIXES
================================================================ */


/* ------------------------------------------------
   REMOVE ALL TOP PAGE GAP
------------------------------------------------ */

html,
body {
    margin: 0 !important;
    padding: 0 !important;
}

body {
    overflow-x: hidden;
}

.site-header {
    margin: 0 !important;
    padding: 0 !important;

    top: 0 !important;
}

.navbar {
    margin-top: 0 !important;
    margin-bottom: 0 !important;
}


/* ------------------------------------------------
   COMPACT MOBILE HISTORY
------------------------------------------------ */

.mobile-history-list {
    display: none;
}

.mobile-history-row {
    width: 100%;

    display: grid;

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

    align-items: center;

    gap: 12px;

    padding:
        14px 0;

    border-bottom:
        1px solid var(--border);
}

.mobile-history-row:last-child {
    border-bottom: 0;
}

.mobile-history-main {
    min-width: 0;
}

.mobile-history-id {
    color: var(--green-900);

    font-family:
        ui-monospace,
        SFMono-Regular,
        Menlo,
        Consolas,
        monospace;

    font-size: 14px;
    font-weight: 800;

    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.mobile-history-time {
    margin-top: 4px;

    color: var(--text-muted);

    font-size: 11px;

    line-height: 1.4;
}

.mobile-history-action .btn {
    min-height: 38px;

    padding:
        0 13px;

    white-space: nowrap;
}


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

@media (max-width: 760px) {

    /* ------------------------------------------------------------
       IMPORTANT:
       KPI cards stay TWO COLUMNS on mobile.
       Applies to Dashboard and Inspection Result.
    ------------------------------------------------------------ */

    .kpi-grid {
        grid-template-columns:
            repeat(
                2,
                minmax(0, 1fr)
            ) !important;

        gap: 10px !important;
    }


    .kpi-card {
        min-width: 0;

        padding:
            15px !important;
    }


    .kpi-icon {
        width: 35px;
        height: 35px;

        margin-bottom: 12px;

        border-radius: 10px;

        font-size: 11px;
    }


    .kpi-label {
        font-size: 11px;

        line-height: 1.35;
    }


    .kpi-value {
        margin-top: 4px;

        font-size: 24px;

        letter-spacing: -0.7px;
    }


    .kpi-foot {
        margin-top: 5px;

        font-size: 10px;

        line-height: 1.35;
    }


    /* ------------------------------------------------------------
       HISTORY:
       Hide old large mobile cards and use compact rows.
    ------------------------------------------------------------ */

    .history-page .mobile-records {
        display: none !important;
    }


    .history-page .mobile-history-list {
        display: block;
    }


    /* ------------------------------------------------------------
       HISTORY PANEL
    ------------------------------------------------------------ */

    .history-page .panel-padding {
        padding:
            17px;
    }


    /* ------------------------------------------------------------
       Result page top area
    ------------------------------------------------------------ */

    .result-hero {
        padding: 19px;
    }


    .result-hero-top {
        gap: 14px;
    }


    /* ------------------------------------------------------------
       Keep result actions full-width
    ------------------------------------------------------------ */

    .result-actions {
        grid-template-columns:
            1fr;
    }


    /* ------------------------------------------------------------
       Header must remain flush with browser top
    ------------------------------------------------------------ */

    .site-header {
        top: 0 !important;
    }
}


/* ================================================================
   SMALL MOBILE
================================================================ */

@media (max-width: 390px) {

    .kpi-grid {
        grid-template-columns:
            repeat(
                2,
                minmax(0, 1fr)
            ) !important;

        gap: 8px !important;
    }


    .kpi-card {
        padding:
            13px !important;
    }


    .kpi-value {
        font-size: 22px;
    }


    .kpi-foot {
        font-size: 9px;
    }


    .mobile-history-row {
        gap: 8px;
    }


    .mobile-history-action .btn {
        padding:
            0 10px;

        font-size: 12px;
    }
}


/* ================================================================
   FINAL HARD NAVBAR POSITION FIX
================================================================ */

html,
body {
    margin: 0 !important;
    padding: 0 !important;
}

body {
    overflow-x: hidden;
}


/* Header is now physically pinned to the top of the viewport */

.site-header {
    position: fixed !important;

    top: 0 !important;
    left: 0 !important;
    right: 0 !important;

    width: 100% !important;

    margin: 0 !important;
    padding: 0 !important;

    z-index: 9999 !important;

    background: #052e16 !important;
}


/* Desktop navbar height */

.navbar {
    min-height: 72px !important;

    margin-top: 0 !important;
    margin-bottom: 0 !important;
}


/*
   Header is fixed, therefore it no longer consumes document space.
   Add its 72px height + normal 36px content spacing.
*/

main.page-shell {
    padding-top: 108px !important;
}


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

@media (max-width: 760px) {

    .navbar {
        min-height: 64px !important;
    }


    /*
       64px header
       +
       approximately 23px content breathing room
    */

    main.page-shell {
        padding-top: 87px !important;
    }


    .nav-links {
        top: 58px !important;
    }
}


/* ================================================================
   VERY SMALL MOBILE
================================================================ */

@media (max-width: 390px) {

    main.page-shell {
        padding-top: 84px !important;
    }
}


/* ================================================================
   DASHBOARD TOP SPACING FIX
================================================================ */

.dashboard-page main.page-shell {
    padding-top: 88px !important;
}


/* 72px navbar + approximately 16px gap */

@media (max-width: 760px) {

    .dashboard-page main.page-shell {
        padding-top: 76px !important;
    }
}


/* 64px mobile navbar + approximately 12px gap */

@media (max-width: 390px) {

    .dashboard-page main.page-shell {
        padding-top: 74px !important;
    }
}


/* ================================================================
   MOBILE HAMBURGER BUTTON
================================================================ */

.mobile-menu-button {
    flex-direction:
        column !important;

    align-items:
        center !important;

    justify-content:
        center !important;

    gap:
        5px !important;

    font-size:
        0 !important;
}


.hamburger-line {
    width:
        23px !important;

    height:
        2px !important;

    display:
        block !important;

    border-radius:
        100px !important;

    background:
        currentColor !important;
}


@media screen and (max-width: 760px) {

    .mobile-menu-button {
        width:
            48px !important;

        height:
            48px !important;

        min-width:
            48px !important;

        min-height:
            48px !important;

        padding:
            0 !important;
    }

}


/* ================================================================
   MOBILE HEADER FINAL POLISH
================================================================ */

@media screen and (max-width: 760px) {

    /* ------------------------------------------------------------
       SHORTER TOP NAVBAR
    ------------------------------------------------------------ */

    .site-header {
        min-height: 58px !important;
    }


    .navbar {
        min-height: 58px !important;

        padding-top: 6px !important;
        padding-bottom: 6px !important;
    }


    /* ------------------------------------------------------------
       SMALLER BRAND AREA
    ------------------------------------------------------------ */

    .brand {
        gap: 10px !important;
    }


    .brand-mark {
        width: 42px !important;
        height: 42px !important;

        min-width: 42px !important;

        border-radius: 12px !important;

        font-size: 13px !important;
    }


    .brand-title {
        font-size: 15px !important;
    }


    .brand-subtitle {
        font-size: 7px !important;
    }


    /* ------------------------------------------------------------
       HAMBURGER:
       ICON ONLY, NO BOX
    ------------------------------------------------------------ */

    .mobile-menu-button {
        width: 38px !important;
        height: 38px !important;

        min-width: 38px !important;
        min-height: 38px !important;

        padding: 0 !important;
        margin: 0 !important;

        display: flex !important;

        flex-direction: column !important;

        align-items: center !important;
        justify-content: center !important;

        gap: 5px !important;

        border: 0 !important;

        border-radius: 0 !important;

        outline: 0 !important;

        background: transparent !important;

        box-shadow: none !important;

        color: white !important;

        font-size: 0 !important;
    }


    .mobile-menu-button:hover,
    .mobile-menu-button:focus,
    .mobile-menu-button:active {
        border: 0 !important;

        background: transparent !important;

        box-shadow: none !important;
    }


    .hamburger-line {
        width: 23px !important;
        height: 2px !important;

        min-width: 23px !important;
        min-height: 2px !important;

        display: block !important;

        flex: 0 0 2px !important;

        border-radius: 50px !important;

        background: white !important;

        opacity: 1 !important;

        visibility: visible !important;

        transform: none !important;
    }


    /*
       Even while the navigation menu is open,
       keep all three hamburger lines visible.
    */

    .mobile-menu-button[aria-expanded="true"]
    .hamburger-line {
        display: block !important;

        opacity: 1 !important;

        visibility: visible !important;

        transform: none !important;
    }


    /*
       Because navbar is now 58px instead of 64px,
       move dropdown accordingly.
    */

    .nav-links {
        top: 58px !important;
    }

}


/* ================================================================
   CAMERA CAPTURE - MOBILE ONLY
================================================================ */

/*
   Laptop / desktop:
   hide links pointing to the web Camera page.

   Upload remains available.
*/

@media screen and (min-width: 761px) {

    a[href="/scan/capture/"],
    a[href$="/scan/capture/"],
    a[href*="/scan/capture/?"] {
        display: none !important;
    }

}


/*
   Mobile:
   camera links work normally.
*/

@media screen and (max-width: 760px) {

    a[href="/scan/capture/"],
    a[href$="/scan/capture/"],
    a[href*="/scan/capture/?"] {
        display: flex;
    }

}


/* ================================================================
   CAMERA CAPTURE - MOBILE ONLY
================================================================ */

/*
   Laptop / desktop:
   hide links pointing to the web Camera page.

   Upload remains available.
*/

@media screen and (min-width: 761px) {

    a[href="/scan/capture/"],
    a[href$="/scan/capture/"],
    a[href*="/scan/capture/?"] {
        display: none !important;
    }

}


/*
   Mobile:
   camera links work normally.
*/

@media screen and (max-width: 760px) {

    a[href="/scan/capture/"],
    a[href$="/scan/capture/"],
    a[href*="/scan/capture/?"] {
        display: flex;
    }

}

