/* 
   responsive - all media queries
    */

/* intermediate breakpoint - compact header before mobile */
@media (max-width: 1200px) {
    .main-nav {
        gap: 0.5rem;
        margin-left: 1.5rem;
    }

    .nav-btn {
        font-size: 0.7rem;
        padding: 0.4rem 0.6rem;
    }

    .header-search-wrap {
        width: 140px;
        min-width: 100px;
        padding: 0.4rem 0.8rem;
    }



    .site-header {
        width: calc(100% - 2rem);
    }
}

/* mobile breakpoint (max-width: 768px) */
@media (max-width: 768px) {

    /* hide desktop header on mobile */
    .desktop-header {
        display: none !important;
    }

    /* show & style mobile header */
    .mobile-header {
        display: block;
        position: fixed;
        top: 0.5rem;
        left: 50%;
        transform: translateX(-50%);
        width: calc(100% - 2rem);
        max-width: 400px;
        z-index: 1000;
        background: rgba(255, 255, 255, 0.85);
        backdrop-filter: blur(30px) saturate(200%);
        -webkit-backdrop-filter: blur(30px) saturate(200%);
        border: 1px solid rgba(255, 255, 255, 0.6);
        border-radius: 999px;
        box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
        padding: 0.3rem 0.5rem;
    }

    .mobile-header .mobile-nav-icons {
        display: flex;
        align-items: center;
        justify-content: space-around;
        width: 100%;
    }

    .mb-nav-btn {
        background: transparent;
        border: none;
        color: #555;
        padding: 6px 12px;
        border-radius: 999px;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        cursor: pointer;
        transition: background-color 0.2s ease, color 0.2s ease, transform 0.15s ease;
        gap: 3px;
    }

    .mb-nav-btn.active {
        color: var(--accent-color);
        background-color: rgba(29, 78, 216, 0.08);
    }
    
    .mb-nav-btn svg {
        width: 20px;
        height: 20px;
    }

    .mb-nav-label {
        font-size: 0.65rem;
        font-weight: 700;
        letter-spacing: 0.04em;
        text-transform: uppercase;
        opacity: 0.8;
    }

    .mb-nav-btn:active {
        background: rgba(0, 0, 0, 0.08);
        transform: scale(0.95);
    }

    /* move nav to drawer (disabled on mobile now) */
    .main-nav {
        display: none !important;
    }

    /* hero section */
    #page-hero {
        background: radial-gradient(circle at 50% 50%, rgba(0, 78, 204, 0.03) 0%, transparent 80%);
    }

    .hero-content-glass {
        background: rgba(255, 255, 255, 0.45);
        backdrop-filter: blur(30px) saturate(150%);
        -webkit-backdrop-filter: blur(30px) saturate(150%);
        border: 1px solid rgba(255, 255, 255, 0.6);
        padding: 3rem 1.5rem;
        /* more compact */
        border-radius: 40px;
        margin: 0 1rem;
        width: calc(100% - 2rem);
        box-shadow:
            0 30px 60px rgba(0, 0, 0, 0.06),
            inset 0 0 0 1px rgba(255, 255, 255, 0.4);
    }


    .hero-wrapper {
        margin: 0;
        transform: none;
        padding: 0;
    }

    .hero-display-text {
        font-size: clamp(2.8rem, 12vw, 4.5rem);
        margin-bottom: 2.5rem;
        letter-spacing: -0.05em;
    }

    .hero-display-text .sub-hero {
        font-size: clamp(1rem, 4vw, 1.4rem);
        margin-top: 1rem;
        opacity: 0.8;
    }

    .hero-cta-group {
        flex-direction: column;
        gap: 1rem;
        width: 100%;
        max-width: 400px;
        margin-left: auto;
        margin-right: auto;
    }



    .btn-text {
        padding: 0.75rem 1.5rem;
        font-size: 0.8rem;
    }

    /* split layout */
    /* split layout - switch to column earlier for tablets */
    .split-layout {
        flex-direction: column;
        gap: 0;
    }

    .split-left {
        position: relative;
        top: 0;
        height: auto;
        padding: 4rem 2rem;
        text-align: center;
        background: var(--bg-color);
        width: 100%;
    }

    .preview-title {
        font-size: 3rem;
        margin: 1rem 0;
        line-height: 1.1;
    }


    .split-right {
        padding: 0 1rem 6rem;
        width: 100%;
    }

    .step-item {
        padding: 4rem 2rem;
        margin-bottom: 2rem;
        border-bottom: 1px solid var(--border-color);
    }

    /* grid layouts */
    .grid-layout {
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
        gap: 1.5rem;
    }

    .dashboard-panels {
        grid-template-columns: 1fr;
        gap: 2rem;
    }

    /* forms */
    .form-row {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .tech-form {
        padding: 1.5rem;
    }
}

/* tablet breakpoint (max-width: 1366px) - unified header collapse */
@media (max-width: 1366px) {

    /* 1. header & nav fixes */

    /* show hamburger menu on tablets */
    .menu-toggle {
        display: flex;
        order: 3;
    }

    /* keep the floating dock header centered and evenly spaced (like desktop)
       on tablets. below 769px the dock header is hidden, so this only ever
       affects the 769-1366px range. */
    /* the max-width:1200px rule stretches .site-header to full width, which
       leaves the dock buttons floating in the middle of a very long pill.
       restore max-content so the pill hugs its buttons (still capped by the
       base max-width so it can't overflow a narrow tablet). */
    .site-header.desktop-header {
        width: max-content;
    }

    .header-inner {
        /* hug the end buttons closely just enough side padding to clear the
           0.5rem active-highlight bleed so the pill isn't unnecessarily long. */
        padding: 0.35rem 0.7rem;
        gap: 1.5rem;
        justify-content: center;
    }

    /* the tighter tablet gap brings buttons close together, so trim the
       active-highlight bleed so the login pill can't overlap the divider /
       reunite logo beside it. */
    .desktop-header .dock-btn::before {
        left: -0.5rem;
        right: -0.5rem;
    }

    .logo-area {
        order: 1;
        margin-right: auto;
        /* allow it to push other items */
        flex-shrink: 0;
    }

    /* move nav to drawer */
    .main-nav {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        width: 100vw;
        height: 100vh;
        background: var(--panel-bg);
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 1.5rem;
        z-index: 1050;
        margin: 0;
        padding: 4rem 2rem 2rem;
        overflow-y: auto;
    }

    .main-nav.mobile-open {
        display: flex;
    }

    .nav-btn {
        font-size: 1.1rem;
        padding: 1rem 2rem;
        width: 100%;
        max-width: 340px;
        text-align: center;
        border: 1px solid var(--border-color);
        background: var(--panel-bg);
        border-radius: 8px;
    }

    /* hide desktop search on tablet */
    .header-search-wrap {
        display: none !important;
    }

    /* keep actions container for gear icon, but hide buttons */
    .header-actions {
        display: flex !important;
        gap: 0.5rem;
        order: 2;
    }

    .header-actions .btn-sm {
        display: none !important;
    }

    /* ensure mobile nav actions appear in the menu drawer */
    .mobile-nav-actions {
        display: flex !important;
        flex-direction: column;
        align-items: center;
        gap: 1rem;
        width: 100%;
        max-width: 340px;
        margin-top: 1.5rem;
        padding-top: 1.5rem;
        border-top: 1px solid var(--border-color);
    }

    .mobile-nav-actions .nav-btn {
        background: var(--text-color);
        color: #fff;
        border-color: var(--text-color);
        font-weight: 700;
        letter-spacing: 0.1em;
        transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    }

    .mobile-nav-actions .nav-btn:active {
        transform: scale(0.98);
        opacity: 0.9;
    }

    /* 2. layout fixes (overflow & spacing) */

    #main-container {
        padding-top: 5rem;
        overflow-x: hidden;
        /* critical for tablet overflow */
    }

    .hero-centered-content {
        min-height: 80vh;
        /* reduce from 100vh so it doesn't feel endless */
        padding-top: 2rem;
    }

    .hero-content-glass {
        width: 90%;
        /* prevent touching edges */
        max-width: 700px;
        padding: 3rem 2rem;
    }

    .hero-display-text {
        font-size: clamp(3.5rem, 11vw, 6rem);
        line-height: 1.1;
        letter-spacing: -0.03em;
    }

    .hero-display-text .sub-hero {
        font-size: 1.25rem;
        margin-top: 1rem;
        opacity: 0.9;
    }

    /* 3. how it works - fix huge cards */

    .split-layout {
        flex-direction: column;
        gap: 0;
    }

    .split-left {
        position: relative;
        height: auto;
        padding: 3rem 1rem 1rem;
        background: transparent;
        margin-bottom: 0;
    }

    .preview-title {
        font-size: 3rem;
        margin: 0.5rem 0;
    }

    /* hide redundant preview on tablet (same as mobile) */
    .step-preview {
        display: none;
    }

    /* use the horizontal scroll layout (like mobile) for tablets too */
    .split-right {
        padding: 1rem 0 4rem;
        width: 100%;
        display: flex;
        flex-direction: row;
        overflow-x: auto;
        scroll-snap-type: x mandatory;
        gap: 1.5rem;
        padding-left: 2rem;
        padding-right: 2rem;
        -webkit-overflow-scrolling: touch;
    }

    .step-item {
        flex: 0 0 60vw;
        /* visible next card */
        max-width: 500px;
        min-height: 350px;
        /* reduce height */
        padding: 2.5rem 2rem;
        margin: 0;
        scroll-snap-align: center;
        transform: none !important;
        /* disable the scroll transform effect which assumes vertical */
        opacity: 1 !important;
    }

    /* hide the huge background number on smaller screens as it causes clutter */
    .step-item::after {
        font-size: 15rem;
        top: 60%;
    }

    .scroll-hint {
        display: none;
        /* hide 'scroll to explore' as it's now 'swipe' */
    }

    /* adjust scroll indicator for tablet height */
    .scroll-indicator {
        bottom: 2rem;
        transform: translateX(-50%) scale(0.9);
    }
}

/* mobile breakpoint (max-width: 768px) */
@media (max-width: 768px) {

    /* header - show hamburger menu */
    .menu-toggle {
        display: flex;
        order: 3;
    }

    .header-inner {
        padding: 0.75rem 1rem;
        gap: 0.5rem;
        /* reduced gap between elements */
    }

    .logo-area {
        order: 1;
        margin-right: auto;
    }

    /* floating header adjustments for mobile */
    .site-header {
        top: 0.5rem;
        width: calc(100% - 1rem);
        border-radius: 14px;
        box-shadow:
            0 8px 24px rgba(0, 50, 150, 0.06),
            inset 0 0 0 1px rgba(255, 255, 255, 0.4);
    }

    .site-header.scrolled {
        top: 0.5rem;
        width: calc(100% - 1rem);
        border-radius: 12px;
        box-shadow:
            0 6px 20px rgba(0, 0, 0, 0.08),
            inset 0 0 0 1px rgba(255, 255, 255, 0.5);
    }

    /* hide nav by default on mobile */
    .main-nav {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        width: 100vw;
        height: 100vh;
        background: var(--panel-bg);
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 1.5rem;
        z-index: 1050;
        margin: 0;
        padding: 4rem 2rem 2rem;
        overflow-y: auto;
    }

    .main-nav.mobile-open {
        display: flex;
    }

    .nav-btn {
        font-size: 1.1rem;
        padding: 1rem 2rem;
        width: 100%;
        max-width: 300px;
        text-align: center;
        border: 1px solid var(--border-color);
        background: var(--panel-bg);
        border-radius: 8px;
    }

    .nav-btn:hover,
    .nav-btn.active {
        background: var(--text-color);
        color: #fff;
    }

    /* hide search bar on mobile header */
    .header-search-wrap {
        display: none;
    }

    /* hide header action buttons on mobile - only gear stays */
    .header-actions {
        display: flex;
        gap: 0.5rem;
        order: 2;
    }

    .header-actions .btn-sm {
        display: none !important;
    }

    .btn-sm {
        padding: 0.4rem 0.8rem;
        font-size: 0.65rem;
    }

    /* menu toggle stays visible */
    .menu-toggle {
        display: flex;
        order: 2;
    }

    /* mobile nav actions - show in menu overlay */
    .mobile-nav-actions {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 1rem;
        width: 100%;
        margin-top: 2rem;
        padding-top: 2rem;
        border-top: 1px solid var(--border-color);
    }

    .mobile-nav-actions .nav-btn {
        background: var(--text-color);
        color: #fff;
        border-color: var(--text-color);
        font-weight: 700;
        letter-spacing: 0.1em;
        transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    }

    .mobile-nav-actions .nav-btn:active {
        transform: scale(0.98);
        opacity: 0.9;
    }

    .mobile-nav-actions .nav-btn:hover {
        background: var(--accent-color);
        border-color: var(--accent-color);
    }

    /* main container */
    #main-container {
        padding-top: 4rem;
    }

    .view-section {
        padding: 2rem 1rem;
    }

    /* hero section - mobile optimized */
    .hero-centered-content {
        min-height: auto;
        padding: 2.5rem 0 1rem;
    }

    .hero-wrapper {
        margin: 0 auto;
        padding: 0 0.5rem;
    }

    .hero-top-label {
        font-size: 0.6rem;
        letter-spacing: 0.15em;
        margin-bottom: 1.5rem;
        padding-left: 0.75rem;
    }

    .hero-display-text {
        font-size: clamp(2rem, 12vw, 3.5rem);
        margin-bottom: 2rem;
        line-height: 1;
    }

    .hero-display-text .sub-hero {
        font-size: clamp(0.9rem, 4vw, 1.3rem);
        margin-top: 1rem;
        line-height: 1.3;
    }

    .hero-cta-group {
        flex-direction: column;
        gap: 1rem;
        margin-top: 1.5rem;
        align-items: stretch;
        padding: 0 1rem;
    }



    .btn-text {
        padding: 0.75rem 1rem;
        font-size: 0.75rem;
        letter-spacing: 0.1em;
    }

    /* how it works - mobile */
    .split-layout {
        flex-direction: column;
        gap: 0;
    }

    .split-left {
        position: relative;
        top: 0;
        height: auto;
        padding: 2rem 1rem 0rem;
        text-align: center;
        z-index: 5;
        background: transparent;
    }

    /* hide redundant preview */
    .split-left .step-preview {
        display: none;
    }

    .label-tech {
        font-size: 0.75rem;
        margin-bottom: 0.5rem;
        opacity: 0.8;
    }

    /* horizontal flashcard layout for mobile */
    .split-right {
        padding-top: 0.5rem;
        /* reduced padding top to pull closer */
        padding-bottom: 2rem;
        width: 100%;
        display: flex;
        flex-direction: row;
        overflow-x: scroll;
        scroll-snap-type: x mandatory;
        gap: 1rem;
        /* center the 85vw cards: (100vw - 85vw) / 2 = 7.5vw */
        padding-left: 7.5vw;
        padding-right: 7.5vw;
        -webkit-overflow-scrolling: touch;
        /* hide scrollbar */
        -ms-overflow-style: none;
        scrollbar-width: none;
    }

    .split-right::-webkit-scrollbar {
        display: none;
    }

    /* mobile scroll hint - "swipe" */
    .scroll-hint {
        display: flex !important;
        flex-direction: column;
        align-items: center;
        gap: 0.75rem;
        margin: 2rem 0;
        width: 100%;
        opacity: 0.8;
    }


    .hint-text {
        font-size: 0.6rem !important;
        color: var(--accent-color);
        letter-spacing: 0.25em;
        font-weight: 700;
        text-transform: uppercase;
        display: block;
    }

    .hint-line {
        display: block !important;
        width: 80px;
        height: 2px;
        background: linear-gradient(to right, rgba(0, 78, 204, 0.2), transparent);
        position: relative;
        overflow: hidden;
        border-radius: 2px;
    }

    .hint-line::after {
        content: '';
        position: absolute;
        top: 0;
        left: -100%;
        width: 100%;
        height: 100%;
        background: var(--accent-color);
        box-shadow: 0 0 8px var(--accent-color);
        animation: hintLineFlowHorizontal 2s cubic-bezier(0.16, 1, 0.3, 1) infinite;
    }

    @keyframes hintLineFlowHorizontal {
        0% {
            left: -100%;
        }

        50%,
        100% {
            left: 100%;
        }
    }


    .step-item {
        flex: 0 0 80vw;
        min-height: 400px;
        /* taller cards to fill the screen */
        scroll-snap-align: center;
        padding: 3rem 2.5rem;
        margin: 0;
        background: rgba(255, 255, 255, 0.9);
        /* opaque glass */
        backdrop-filter: blur(15px);
        -webkit-backdrop-filter: blur(15px);
        border: 1px solid rgba(255, 255, 255, 0.6);
        border-radius: 36px;
        opacity: 1;
        transform: scale(0.92);
        box-shadow: 0 25px 60px rgba(0, 50, 150, 0.08);
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        text-align: center;
        transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
        position: relative;
        overflow: hidden;
    }

    /* modern background number for depth */
    .step-item::after {
        content: attr(data-step);
        position: absolute;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        font-size: 20rem;
        /* huge background number */
        font-weight: 900;
        color: rgba(0, 78, 204, 0.04);
        z-index: -1;
        opacity: 0.5;
        pointer-events: none;
    }

    /* focused card highlight */
    .step-item.active {
        transform: scale(1);
        border-color: rgba(0, 78, 204, 0.2);
        box-shadow: 0 20px 50px rgba(0, 78, 204, 0.12);
    }

    .step-item h3 {
        font-size: 2.4rem;
        font-weight: 800;
        margin-bottom: 1.5rem;
        letter-spacing: -0.02em;
        line-height: 1.1;
    }

    .step-item p {
        font-size: 1.1rem;
        line-height: 1.7;
        color: var(--muted-text);
        max-width: 280px;
        margin: 0 auto;
    }

    .step-num {
        font-size: 0.9rem;
        color: var(--accent-color);
        font-weight: 700;
        letter-spacing: 0.15em;
        margin-bottom: 0.75rem;
        text-transform: uppercase;
    }

    /* found items section */
    .section-head {
        margin-bottom: 2rem;
    }

    .section-head h2 {
        font-size: 1.8rem;
    }

    .filter-ui {
        grid-template-columns: 1fr;
        gap: 0.75rem;
        margin-bottom: 2rem;
    }

    .input-tech {
        padding: 0.75rem;
        font-size: 0.7rem;
    }

    /* mobile 2-column inventory grid */
    #itemsGrid, #claimedItemsGrid {
        display: grid !important;
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 12px !important;
    }

    .item-card {
        flex-direction: column;
        align-items: flex-start;
        padding: 0.5rem !important;
        border-radius: 12px;
    }

    .card-thumb {
        width: 100% !important;
        height: 120px !important;
        margin-right: 0 !important;
        margin-bottom: 0.5rem;
        border-radius: 8px !important;
    }

    .card-meta {
        align-items: flex-start;
        width: 100%;
        margin-left: 0 !important;
    }

    .card-title {
        font-size: 1rem !important;
        margin-bottom: 2px !important;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        width: 100%;
    }

    .card-tags {
        margin-top: 4px !important;
        flex-wrap: wrap;
        gap: 4px !important;
    }

    .tag {
        font-size: 0.65rem !important;
        padding: 2px 6px !important;
    }



    .filter-meta {
        flex-direction: column;
        align-items: flex-start;
    }

    .results-meta {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }

    .grid-layout {
        grid-template-columns: 1fr;
        gap: 1.25rem;
    }

    /* cards */
    .item-card {
        padding: 1.25rem;
    }

    .card-image-wrap {
        margin: -1.25rem -1.25rem 1rem -1.25rem;
        height: 150px;
    }

    .card-title {
        font-size: 1.2rem;
    }

    .card-desc {
        font-size: 0.85rem;
        margin-bottom: 1.5rem;
    }

    /* forms */
    .section-centered {
        padding: 0;
    }

    .tech-form {
        padding: 1.25rem;
        box-shadow: 4px 4px 0 var(--border-color);
    }

    .input-group input,
    .input-group select,
    .input-group textarea {
        padding: 0.65rem 0.75rem;
        font-size: 0.7rem;
    }

    .file-upload-ui {
        min-height: 100px;
        padding: 1rem;
    }

    .file-label {
        font-size: 0.65rem;
    }

    /* dashboard */
    .dashboard-grid-container {
        gap: 1rem;
    }

    .stats-row {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 0.75rem;
    }

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

    .card-large-span,
    .card-mid-span,
    .card-small-span,
    .card-full-span {
        grid-column: span 1;
    }

    .admin-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
        margin-bottom: 1.5rem;
    }

    .admin-actions {
        width: 100%;
        margin: 0;
    }

    .admin-actions .btn-sm {
        width: 100%;
        padding: 0.75rem;
        justify-content: center;
    }

    .list-item {
        padding: 1.25rem;
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }

    .admin-actions-inline {
        width: 100%;
        flex-direction: column;
        gap: 0.5rem;
    }

    .admin-actions-inline .btn-sm {
        width: 100%;
        text-align: center;
        justify-content: center;
    }

    /* audit log mobile fix */
    .audit-log-container {
        border-radius: 12px;
    }

    .audit-header {
        display: none;
    }

    .audit-entry {
        grid-template-columns: 1fr;
        gap: 0.75rem;
        padding: 1.25rem;
        border-bottom: 8px solid rgba(0, 0, 0, 0.02);
    }

    .audit-entry>div {
        display: flex;
        justify-content: space-between;
        align-items: center;
        width: 100%;
    }

    .audit-entry>div::before {
        content: attr(data-label);
        font-family: var(--font-mono);
        font-size: 0.6rem;
        font-weight: 700;
        letter-spacing: 0.1em;
        color: var(--muted-text);
        text-transform: uppercase;
    }

    .audit-time,
    .audit-user,
    .audit-resource {
        font-size: 0.8rem;
    }

    .audit-user {
        font-weight: 700;
    }

    .audit-resource {
        text-align: right;
        font-style: normal;
        color: var(--text-color);
    }

    /* modals */
    .modal-overlay {
        padding: 1rem;
    }

    .modal-box {
        max-height: calc(100vh - 2rem);
    }

    .modal-box.large {
        max-width: 100%;
    }

    .modal-header {
        padding: 1rem 1.25rem;
    }

    .modal-body {
        padding: 1.5rem 1.25rem;
    }

    .modal-photo {
        max-height: 250px;
    }

    /* visual search */
    .visual-search-group {
        margin-bottom: 2rem !important;
    }

    .ai-scan-container {
        padding: 1rem;
        font-size: 0.65rem;
    }
}

/* small mobile (max-width: 480px) */
@media (max-width: 480px) {
    .hero-display-text {
        font-size: clamp(1.75rem, 14vw, 2.5rem);
    }

    .hero-display-text .sub-hero {
        font-size: clamp(0.8rem, 4.5vw, 1.1rem);
    }

    .hero-top-label {
        font-size: 0.55rem;
    }

    .btn-primary {
        padding: 0.9rem 1.25rem;
        font-size: 0.7rem;
        letter-spacing: 0.1em;
    }

    .btn-text {
        font-size: 0.7rem;
        letter-spacing: 0.05em;
    }

    .preview-title {
        font-size: 2rem;
    }

    .section-head h2 {
        font-size: 1.5rem;
    }

    .label-tech {
        font-size: 0.9rem;
    }

    /* floating header for tiny phones */
    .site-header {
        top: 0.35rem;
        width: calc(100% - 0.7rem);
        border-radius: 12px;
    }

    .site-header.scrolled {
        top: 0.35rem;
        width: calc(100% - 0.7rem);
    }

    .header-inner {
        padding: 0.6rem 0.75rem;
    }

    .stats-row {
        grid-template-columns: repeat(2, 1fr) !important;
    }
}

/* landscape orientation fix for mobile */
@media (max-height: 500px) and (orientation: landscape) {
    .hero-wrapper {
        margin: 2vh auto;
    }

    .hero-display-text {
        font-size: 2.5rem;
        margin-bottom: 1.5rem;
    }

    .hero-display-text .sub-hero {
        font-size: 1rem;
        margin-top: 0.5rem;
    }

    .hero-cta-group {
        flex-direction: row;
        gap: 1rem;
    }

    .btn-primary,
    .btn-text {
        width: auto;
    }
}

/* mobile fixes find items, wizards, visual search */
@media (max-width: 768px) {

    /* --- find items: let the page scroll instead of a cramped
       inner scroll-box (100vh math is unreliable on phones). --- */
    #page-found.active {
        padding: 1rem 0.75rem 2.5rem !important;
        min-height: auto !important;
        justify-content: flex-start;
    }

    #page-found .content-wrapper.content-box {
        max-height: none !important;
        overflow: visible !important;
        padding: 0 1rem 1.25rem !important;
        border-radius: var(--radius-md);
    }

    /* header row: stop it sticking (would collide with the floating
       header) and drop the edge-bleed negative margins. */
    #page-found .section-head {
        position: static !important;
        margin: 0 0 1.25rem !important;
        padding: 1rem 0 0.75rem !important;
        flex-direction: column;
        align-items: stretch;
        gap: 0.75rem;
     }
     #page-found .section-head .browse-inventory-title {
         margin-left: 0 !important;
     }
     #page-found .fp-topsearch { width: 100% !important; }

    /* visual search bar: stack vertically so nothing overflows. */
    #page-found .fp-visual-bar {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }
    #page-found .fp-upload-btn { justify-content: center; }
    #page-found .fp-drag-hint { text-align: center; }
    #page-found .fp-visual-bar .fp-match-mode {
        width: 100% !important;
    }

    /* scan results: photo on top, matches below; single-column cards. */
    #page-found .fp-scan-grid { flex-direction: column; }
    #page-found #aiMatchResults { grid-template-columns: 1fr; }
    #page-found #aiMatchContainer { padding: 14px; }

    /* claimed archive: single column, taller scroll budget. */
    #page-found .claimed-grid {
        grid-template-columns: 1fr;
        max-height: 320px;
    }

    /* --- report / claim wizards: align to top so tall forms never
       get clipped above the fold by justify-content:center. --- */
    #page-report.active,
    #page-claim.active {
        justify-content: flex-start !important;
        min-height: auto !important;
        padding-top: 1.25rem !important;
    }
}

/* mobile fullscreen nav dark, centered, borderless */
@media (max-width: 1366px) {
    .main-nav {
        background: #0e1726 !important;          /* deep ink overlay */
        gap: 0.15rem !important;
        padding: 5.5rem 1.5rem 2.5rem !important;
        justify-content: center !important;
        overflow-y: auto !important;
    }

    /* primary nav links: large white text, no boxes */
    .main-nav > .nav-btn {
        font-family: var(--font-display, 'Bricolage Grotesque', sans-serif);
        font-size: 1.65rem !important;
        font-weight: 700 !important;
        text-transform: none !important;
        letter-spacing: -0.01em !important;
        color: rgba(255, 255, 255, 0.92) !important;
        background: transparent !important;
        border: none !important;
        border-radius: 0 !important;
        width: auto !important;
        max-width: none !important;
        padding: 0.65rem 1rem !important;
    }

    .main-nav > .nav-btn::after { display: none !important; }

    .main-nav > .nav-btn:hover,
    .main-nav > .nav-btn:active,
    .main-nav > .nav-btn.active {
        color: #fff !important;
        background: transparent !important;
        opacity: 0.75;
    }

    /* secondary actions: pill buttons */
    .mobile-nav-actions {
        border-top: 1px solid rgba(255, 255, 255, 0.12) !important;
        margin-top: 2.25rem !important;
        padding-top: 1.75rem !important;
        gap: 0.7rem !important;
        width: 100% !important;
        max-width: 340px !important;
    }

    .mobile-nav-actions .nav-btn {
        font-family: var(--font-mono) !important;
        font-size: 0.78rem !important;
        font-weight: 600 !important;
        letter-spacing: 0.12em !important;
        background: transparent !important;
        color: rgba(255, 255, 255, 0.7) !important;
        border: 1px solid rgba(255, 255, 255, 0.2) !important;
        border-radius: 999px !important;
        width: 100% !important;
        max-width: none !important;
        padding: 0.85rem 1.5rem !important;
    }

    .mobile-nav-actions .nav-btn::after { display: none !important; }

    .mobile-nav-actions .nav-btn:hover,
    .mobile-nav-actions .nav-btn:active {
        background: rgba(255, 255, 255, 0.08) !important;
        color: #fff !important;
        border-color: rgba(255, 255, 255, 0.35) !important;
    }

    /* primary cta sign in / dashboard get a filled accent pill */
    #mobileLoginBtn:not(.hidden),
    #mobileDashboardBtn:not(.hidden) {
        background: var(--accent-color) !important;
        color: #fff !important;
        border-color: var(--accent-color) !important;
    }
    #mobileLoginBtn:hover,
    #mobileDashboardBtn:hover {
        background: var(--accent-deep) !important;
        border-color: var(--accent-deep) !important;
    }

    /* close (x) button solid white chip, floats above the dark overlay */
    .menu-toggle.active {
        background: #fff !important;
        border-color: transparent !important;
        box-shadow: 0 4px 14px rgba(0, 0, 0, 0.3);
        z-index: 1100;
    }

    /* native mobile dashboard (replaces desktop scrollhero) */

    .mobile-native-dashboard {
        display: flex !important;
        flex-direction: column;
        width: 100%;
        margin-top: -6rem; /* pull up over the waves */
        padding: 7rem 1.25rem 6.5rem; /* offset the negative margin and sit below header */
        box-sizing: border-box;
        background: #fafafa;
        min-height: 100vh;
        min-height: 100dvh;
    }

    /* hide desktop hero elements */
    .scrollhero {
        display: none !important;
    }

    /* dashboard header */
    .mb-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        width: 100%;
        margin-bottom: 1rem;
        padding-top: env(safe-area-inset-top, 0.5rem);
    }

    .mb-icon-btn {
        background: rgba(0, 0, 0, 0.04);
        border: none;
        color: #000;
        width: 44px;
        height: 44px;
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
        cursor: pointer;
        transition: transform 0.15s ease;
        position: relative;
    }

    .mb-icon-btn:active {
        background: rgba(0, 0, 0, 0.08);
        transform: scale(0.95);
    }

    .mb-badge {
        position: absolute;
        top: -2px;
        right: -2px;
        background: #ef4444;
        color: #fff;
        font-size: 0.65rem;
        font-weight: 700;
        width: 16px;
        height: 16px;
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
        border: 1.5px solid #fafafa;
        font-family: var(--font-mono);
    }

    /* greeting */
    .mb-greeting {
        margin: 1.5rem 0 2rem;
        display: flex;
        justify-content: space-between;
        align-items: center;
    }
    
    .mb-greeting-logo {
        height: 44px;
        width: auto;
        opacity: 0.9;
    }

    .mb-greeting h1,
    .mb-greeting h2 {
        font-family: var(--font-display);
        font-size: clamp(32px, 8.5vw, 42px);
        font-weight: 800;
        color: #0f172a;
        line-height: 1.15;
        letter-spacing: -0.02em;
        margin: 0;
    }

    /* action grid */
    .mb-grid {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 16px;
        width: 100%;
        box-sizing: border-box;
    }

    .mb-grid-card {
        background: #d8f3fd !important;
        border: none !important;
        border-radius: 24px;
        box-shadow: none !important;
        padding: 1.25rem;
        display: flex;
        flex-direction: column;
        align-items: flex-start;
        justify-content: space-between;
        aspect-ratio: 1 / 1;
        height: auto;
        cursor: pointer;
        transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), background-color 0.2s ease, box-shadow 0.2s ease;
        text-align: left;
        box-sizing: border-box;
    }

    .mb-grid-card:active {
        transform: scale(0.96);
        background-color: #bae6fd !important;
    }

    .card-icon-wrap {
        background: #ffffff !important;
        color: #000000 !important;
        width: 42px;
        height: 42px;
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
        transition: transform 0.2s ease;
    }

    .mb-grid-card span {
        font-family: var(--font-display);
        font-size: 1.25rem;
        font-weight: 800;
        letter-spacing: -0.02em;
        color: #0f172a;
    }

    /* search pill */
    .mb-search-bar {
        margin-top: 2rem;
        width: 100%;
        box-sizing: border-box;
    }

    .mb-search-bar input {
        width: 100%;
        padding: 1.1rem 1.5rem;
        border-radius: 999px;
        border: 1px solid rgba(0, 0, 0, 0.08);
        background: #fff;
        font-family: var(--font-main);
        font-size: 0.95rem;
        color: #0f172a;
        box-sizing: border-box;
        box-shadow: 0 4px 10px rgba(0, 0, 0, 0.02);
    }

    .mb-search-bar input::placeholder {
        color: #94a3b8;
    }

    /* floating navigation */
    .mobile-floating-nav {
        display: flex !important;
        position: fixed;
        bottom: 24px;
        left: 50%;
        transform: translateX(-50%);
        width: calc(100vw - 3rem);
        max-width: 360px;
        justify-content: space-between;
        align-items: center;
        z-index: 1000;
        pointer-events: none;
    }

    .mobile-floating-nav > * {
        pointer-events: auto;
    }

    .nav-pill-left {
        display: flex;
        align-items: center;
        background: #000;
        border-radius: 999px;
        padding: 6px;
        gap: 8px;
        box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    }

    .nav-tab {
        background: transparent;
        border: none;
        width: 44px;
        height: 44px;
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
        color: #a3a3a3;
        cursor: pointer;
        transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    }

    .nav-tab.active {
        background: rgba(255, 255, 255, 0.15);
        color: #fff;
    }

    .nav-circle-right {
        width: 56px;
        height: 56px;
        border-radius: 50%;
        background: #000;
        color: #fff;
        border: none;
        display: flex;
        align-items: center;
        justify-content: center;
        cursor: pointer;
        box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
        transition: transform 0.2s ease;
    }

    .nav-circle-right:active {
        transform: scale(0.92);
    }
}

/* hide mobile elements on desktop */
@media (min-width: 1367px) {
    .mobile-native-dashboard { display: none !important; }
    .mobile-floating-nav { display: none !important; }
    .mobile-header { display: none !important; }
}

/* force fullscreen wizard app views on mobile (cancelling tablet scale overrides) */
@media (max-width: 767px) {
    body.wizard-active {
        background-color: #ffffff !important;
    }
    
    #page-report.active,
    #page-claim.active {
        min-height: 100vh !important;
        min-height: 100dvh !important;
        padding: 0 !important;
    }
    
    .rw-btn-submit {
        display: none !important;
    }

    body.wizard-active .mobile-header,
    body:has(#page-report.active) .mobile-header,
    body:has(#page-claim.active) .mobile-header {
        display: none !important;
    }

    body.wizard-active #main-container,
    body:has(#page-report.active) #main-container,
    body:has(#page-claim.active) #main-container {
        padding-top: 0 !important;
    }
}

/* hide semantic site footer on mobile/tablet to maintain 100svh native app feel */
@media (max-width: 1366px) {
    .site-footer {
        display: none !important;
    }

    /* restore full width for page containers on mobile/tablet */
    #page-found .content-wrapper.content-box,
    .dashboard-page-container,
    .rw-outer,
    .cw-outer {
        max-width: 100% !important;
        width: 100% !important;
    }
}

/* tablet home dashboard (769-1366px) */
@media (min-width: 769px) and (max-width: 1366px) {
    .mobile-native-dashboard {
        max-width: 700px;
        margin-left: auto;
        margin-right: auto;
        padding-top: 6.5rem;
        padding-bottom: 3rem;
    }

    .mb-grid {
        gap: 20px;
    }

    .mb-grid-card {
        aspect-ratio: 1.25 / 1;
    }

    .mb-search-bar {
        margin-top: 1.5rem;
    }
}

/* tablet landscape: the viewport is wide but short, so a 2x2 grid is
   too tall and pushes the search bar off-screen. lay the four boxes in
   a single row so everything fits without scrolling. */
@media (min-width: 769px) and (max-width: 1366px) and (orientation: landscape) {
    .mobile-native-dashboard {
        max-width: 1100px;
        padding-top: 5.5rem;
        padding-bottom: 1.5rem;
    }

    .mb-greeting {
        margin: 0.5rem 0 1.25rem;
    }

    .mb-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 16px;
    }

    .mb-grid-card {
        aspect-ratio: 1 / 1;
    }

    .mb-search-bar {
        margin-top: 1.25rem;
    }
}

/* ios safari focus-zoom fix */
@media (max-width: 1366px) {
    input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="color"]):not(.otp-input),
    textarea,
    select {
        font-size: 16px !important;
    }
}