/* Gluten Free Safari (gfsafari.com) Core Stylesheet
 * Handcrafted Accessible & High-Contrast Mobile-First CSS
 */

:root {
    --bg-primary: #fcfbf9;
    --bg-card: #ffffff;
    --bg-surface: #f7f5f0;
    --border-color: #e8e3da;
    --border-subtle: #f0ebe1;
    --text-primary: #151f18;
    --text-secondary: #4a574e;
    --text-muted: #748278;
    --brand-safari-green: #1a4231;
    --brand-safari-dark: #0f281e;
    --brand-safari-light: #245841;
    --brand-khaki: #c4ad8d;
    --brand-gold: #c98218;
    --brand-amber: #a84b06;
    --brand-accent: #2e7d32;
    --focus-ring: #c98218;
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --font-scale: 1rem;
}

/* Grocery Aisle High-Contrast Mode */
body.high-contrast-mode {
    --bg-primary: #000000;
    --bg-card: #0d0d0d;
    --bg-surface: #1a1a1a;
    --border-color: #ffcc00;
    --border-subtle: #997a00;
    --text-primary: #ffffff;
    --text-secondary: #ffeb99;
    --text-muted: #e6e6e6;
    --brand-safari-green: #ffcc00;
    --brand-safari-dark: #000000;
    --brand-safari-light: #ffe066;
    --brand-khaki: #ffcc00;
    --brand-gold: #ffcc00;
    --brand-amber: #ffcc00;
    --brand-accent: #ffcc00;
    --focus-ring: #ffffff;
}

body.high-contrast-mode .safari-card,
body.high-contrast-mode .badge-pill,
body.high-contrast-mode .store-tag,
body.high-contrast-mode .caution-banner {
    border-color: #ffcc00 !important;
    color: #ffffff !important;
}

/* Accessibility dynamic text scaling */
html {
    font-size: 16px;
    scroll-behavior: smooth;
}
html.font-scale-sm { font-size: 14px; }
html.font-scale-base { font-size: 16px; }
html.font-scale-lg { font-size: 18px; }
html.font-scale-xl { font-size: 20px; }

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

/* Accessibility: Skip to main content (hidden off-screen until tabbed/focused) */
.skip-link {
    position: absolute;
    top: -9999px;
    left: 0.5rem;
    background: var(--brand-safari-green);
    color: #ffffff !important;
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
    font-weight: 700;
    z-index: 99999;
    text-decoration: none;
    border-radius: 0 0 var(--radius-md) var(--radius-md);
    box-shadow: 0 4px 14px rgba(0,0,0,0.2);
    transition: top 0.15s ease;
}
.skip-link:focus {
    top: 0;
    outline: 2px solid var(--brand-gold);
}

html, body {
    width: 100%;
    max-width: 100vw;
    overflow-x: hidden;
}

body {
    background-color: var(--bg-primary);
    color: var(--text-primary);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
    overflow-wrap: break-word;
    word-break: break-word;
}

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

/* SVG Vector Icon Standard */
.svg-icon {
    display: inline-block;
    vertical-align: -0.15em;
    flex-shrink: 0;
    transition: stroke 0.15s ease, fill 0.15s ease;
}

/* High-contrast focus rings */
:focus-visible {
    outline: 2.5px solid var(--focus-ring) !important;
    outline-offset: 2px !important;
}

/* Mobile-first 48x48px tap targets */
.touch-target-48 {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    max-width: 100%;
}

/* Layout Utilities */
.container,
.safari-container {
    width: 100%;
    max-width: 1200px;
    margin-left: auto !important;
    margin-right: auto !important;
    padding-left: 1.25rem;
    padding-right: 1.25rem;
    box-sizing: border-box;
}

@media (max-width: 640px) {
    .container,
    .safari-container {
        padding-left: 0.85rem;
        padding-right: 0.85rem;
    }
}

.safari-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.02);
    transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
    max-width: 100%;
}

@media (max-width: 640px) {
    .safari-card {
        padding: 1.15rem !important;
        border-radius: var(--radius-md);
    }
}

.safari-card:hover {
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.05);
    border-color: var(--brand-khaki);
}

/* Button & Interaction primitives */
.btn-safari {
    background: var(--brand-safari-green);
    color: #ffffff;
    font-weight: 600;
    border-radius: var(--radius-md);
    padding: 0.65rem 1.25rem;
    border: 1.5px solid transparent;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-size: 0.95rem;
    transition: all 0.15s ease;
}

body.high-contrast-mode .btn-safari {
    background: #000000;
    color: #ffcc00;
    border: 2px solid #ffcc00;
}

.btn-safari:hover {
    background: var(--brand-safari-light);
    color: #ffffff;
}

.btn-gold {
    background: var(--brand-gold);
    color: #1a1a1a;
    font-weight: 700;
}
.btn-gold:hover {
    background: #d89020;
    color: #000000;
}

.btn-outline {
    background: transparent;
    color: var(--text-primary);
    border: 1.5px solid var(--border-color);
}
.btn-outline:hover {
    background: var(--bg-surface);
    border-color: var(--text-muted);
}

/* Top Accessibility Toolbar */
.a11y-toolbar {
    background: var(--brand-safari-dark);
    color: #f4efe6;
    padding: 0.35rem 1.5rem;
    font-size: 0.82rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.75rem;
}

body.high-contrast-mode .a11y-toolbar {
    background: #000000;
    border-bottom: 2px solid #ffcc00;
    color: #ffcc00;
}

/* Clean Unboxed Status Indicator */
.status-indicator {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.85rem;
    font-weight: 600;
}
.status-safe { color: #0f766e; }
.status-caution { color: #b45309; }
.status-danger { color: #b91c1c; }

body.high-contrast-mode .status-safe,
body.high-contrast-mode .status-caution,
body.high-contrast-mode .status-danger {
    color: #ffcc00 !important;
}

/* Safari Hat Rating */
.safari-hats,
.pith-helmets {
    display: inline-flex;
    align-items: center;
    gap: 3px;
}
.safari-hat-icon,
.pith-helmet-icon {
    width: 16px;
    height: 16px;
    fill: var(--brand-gold);
}
.safari-hat-icon.empty,
.pith-helmet-icon.empty {
    fill: var(--text-muted);
    opacity: 0.3;
}

/* Speech / Scout Take Note */
.scout-take-card {
    background: var(--bg-surface);
    border-left: 3px solid var(--brand-gold);
    border-radius: 0 var(--radius-md) var(--radius-md) 0;
    padding: 1.1rem 1.25rem;
    position: relative;
}
body.high-contrast-mode .scout-take-card {
    background: #111111;
    border-left: 3px solid #ffcc00;
}

/* Toast alerts */
.toast-container {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}
.safari-toast {
    background: var(--brand-safari-dark);
    color: #ffffff;
    padding: 0.75rem 1.15rem;
    border-radius: var(--radius-md);
    border-left: 3px solid var(--brand-gold);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    animation: slideIn 0.2s ease forwards;
}
body.high-contrast-mode .safari-toast {
    background: #000000;
    border: 2px solid #ffcc00;
    color: #ffcc00;
}

@keyframes slideIn {
    from { transform: translateY(15px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

/* Tables */
.safari-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}
.safari-table th {
    text-align: left;
    padding: 0.75rem 1rem;
    font-weight: 700;
    color: var(--text-secondary);
    border-bottom: 1.5px solid var(--border-color);
    background: var(--bg-surface);
    white-space: nowrap;
}
.safari-table td {
    padding: 0.85rem 1rem;
    border-bottom: 1px solid var(--border-color);
}
.safari-table tr:hover td {
    background: var(--bg-surface);
}

/* Horizontal scroll container with touch momentum */
.horizontal-scroll-touch {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    max-width: 100%;
}
.horizontal-scroll-touch::-webkit-scrollbar {
    height: 4px;
}
.horizontal-scroll-touch::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

/* Safari Header & Subheader */
.safari-header {
    background: var(--bg-card);
    border-bottom: 1px solid var(--border-color);
    padding: 0.65rem 0;
}
.header-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
}
.header-brand {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    text-decoration: none;
    color: var(--text-primary);
    min-width: max-content;
}
.header-mascot-img {
    width: 44px;
    height: 44px;
    flex-shrink: 0;
    object-fit: contain;
}
.header-brand-text .brand-title {
    font-size: 1.12rem;
    font-weight: 800;
    color: var(--brand-safari-green);
    letter-spacing: -0.3px;
    line-height: 1.1;
}
.header-brand-text .brand-sub {
    font-size: 0.7rem;
    color: var(--text-muted);
    font-weight: 500;
}
.header-actions {
    display: flex;
    align-items: center;
    gap: 0.45rem;
}
.header-user-btn {
    background: var(--bg-surface);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 0.35rem 0.65rem;
    text-decoration: none;
    font-size: 0.84rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.03);
    max-width: 140px;
}
.header-user-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.mobile-menu-toggle-btn {
    display: none;
}

/* Safari Subheader Navigation */
.safari-subheader {
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border-color);
    padding: 0.5rem 0;
}
.safari-nav-scroll {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding-bottom: 0.25rem;
}
.safari-nav-item {
    color: var(--text-secondary);
    text-decoration: none;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.86rem;
    font-weight: 500;
    padding: 0.35rem 0.65rem;
    border-radius: var(--radius-md);
    transition: background 0.15s ease, color 0.15s ease;
}
.safari-nav-item:hover {
    color: var(--brand-safari-green);
    background: rgba(26,66,49,0.05);
}
.safari-nav-item.active {
    color: var(--brand-safari-green);
    font-weight: 700;
    background: rgba(26,66,49,0.09);
}

/* Subheader Search & Actions Top Row */
.subheader-top-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.45rem;
}
.subheader-search-form {
    display: flex;
    flex: 1;
    max-width: 540px;
    min-width: min(100%, 220px);
}
.subheader-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.subheader-list-btn {
    padding: 0.35rem 0.75rem;
    font-size: 0.84rem;
    border-radius: var(--radius-md);
    text-decoration: none;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    background: var(--bg-card);
}
.list-counter-badge {
    background: var(--brand-safari-green);
    color: #fff;
    font-size: 0.72rem;
    padding: 0.1rem 0.42rem;
    border-radius: 999px;
    font-weight: 700;
}

/* Mobile Slide-Out Navigation Drawer */
.safari-drawer-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
    z-index: 9998;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s ease, visibility 0.25s ease;
}
.safari-drawer-backdrop.open {
    opacity: 1;
    visibility: visible;
}
.safari-mobile-drawer {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: min(86vw, 340px);
    background: #ffffff;
    z-index: 9999;
    box-shadow: -4px 0 25px rgba(0, 0, 0, 0.15);
    transform: translateX(100%);
    transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1);
    display: flex;
    flex-direction: column;
}
.safari-mobile-drawer.open {
    transform: translateX(0);
}
.drawer-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.15rem;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-surface);
}
.drawer-close-btn {
    border: none;
    background: transparent;
    cursor: pointer;
    color: var(--text-muted);
    padding: 0.35rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
}
.drawer-close-btn:hover {
    color: var(--text-primary);
    background: rgba(0, 0, 0, 0.05);
}
.drawer-body {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 1rem 0.85rem 2rem;
}
.drawer-section-label {
    font-size: 0.72rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    padding: 0 0.5rem 0.35rem;
}
.drawer-nav-list {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}
.drawer-nav-item {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.65rem 0.75rem;
    border-radius: 8px;
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
    transition: background 0.15s ease;
}
.drawer-nav-item:active,
.drawer-nav-item:hover {
    background: var(--bg-surface);
    color: var(--brand-safari-green);
}
.drawer-nav-item.active {
    background: rgba(26, 66, 49, 0.09);
    color: var(--brand-safari-green);
    font-weight: 700;
}
.drawer-nav-item svg {
    flex-shrink: 0;
    color: var(--brand-safari-green);
}

/* General form control responsiveness */
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="search"],
select,
textarea {
    max-width: 100%;
    box-sizing: border-box;
}

/* Header Admin Button */
.header-admin-btn {
    color: #ca8a04;
    background: #fef9c3;
    border: 1px solid #facc15;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    font-size: 0.82rem;
    font-weight: 700;
    padding: 0.35rem 0.65rem;
    border-radius: var(--radius-md);
    transition: background 0.15s ease, transform 0.1s ease;
}
.header-admin-btn:hover {
    background: #fef08a;
}

/* Hero Section Base Ordering */
.hero-section {
    display: flex;
    flex-direction: column;
    align-items: center;
}
.hero-mascot { order: 1; }
.hero-title { order: 2; }
.hero-desc { order: 3; }
.hero-search-box { order: 4; width: 100%; max-width: 620px; }
.hero-latest-blog { order: 5; width: 100%; max-width: 620px; margin-top: 1.25rem; }
.hero-popular { order: 6; }

/* Mobile Responsive Optimization */
@media (max-width: 640px) {
    .header-mascot-img {
        width: 36px !important;
        height: 36px !important;
    }
    .header-brand-text .brand-title {
        font-size: 0.98rem !important;
    }
    .header-brand-text .brand-sub {
        font-size: 0.65rem !important;
    }
    .mobile-menu-toggle-btn {
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
        gap: 0.25rem !important;
        background: var(--bg-surface) !important;
        border: 1px solid var(--border-color) !important;
        border-radius: var(--radius-md) !important;
        padding: 0.35rem 0.6rem !important;
        color: var(--brand-safari-green) !important;
        font-size: 0.8rem !important;
        font-weight: 700 !important;
        cursor: pointer !important;
    }
    .header-signin-btn {
        padding: 0.35rem 0.6rem !important;
        font-size: 0.8rem !important;
    }
    .header-user-btn {
        max-width: 90px !important;
        padding: 0.35rem 0.5rem !important;
        font-size: 0.78rem !important;
    }

    /* Header Admin Button on Mobile is a Shield */
    .header-admin-btn {
        padding: 0.35rem !important;
        border-radius: 50% !important;
        width: 30px !important;
        height: 30px !important;
        min-height: 30px !important;
        min-width: 30px !important;
        gap: 0 !important;
    }
    .header-admin-btn .admin-label {
        display: none !important;
    }
    .header-admin-btn .admin-icon {
        width: 15px;
        height: 15px;
    }

    /* On mobile, search bar moves to top of body below header */
    .hero-section {
        margin: 0.5rem auto 2.5rem !important;
        padding-top: 0.25rem !important;
    }
    .hero-search-box {
        order: -1 !important;
        margin-bottom: 1.25rem !important;
        width: 100% !important;
        max-width: 100% !important;
    }
    .hero-mascot {
        order: 1 !important;
        margin-bottom: 1rem !important;
    }
    .hero-title {
        order: 2 !important;
        margin-bottom: 0.75rem !important;
    }
    .hero-desc {
        order: 3 !important;
        margin-bottom: 1.25rem !important;
        font-size: 0.95rem !important;
    }
    .hero-latest-blog {
        order: 4 !important;
        margin-top: 0 !important;
        margin-bottom: 1.25rem !important;
        width: 100% !important;
        max-width: 100% !important;
    }
    .hero-popular {
        order: 5 !important;
        margin-top: 0 !important;
    }

    /* Subheader search bar layout on mobile */
    .safari-subheader {
        padding: 0.4rem 0 !important;
    }
    .subheader-top-row {
        display: flex !important;
        flex-direction: row !important;
        align-items: center !important;
        gap: 0.4rem !important;
        margin-bottom: 0.35rem !important;
    }
    .subheader-search-form {
        flex: 1 !important;
        width: auto !important;
        max-width: 100% !important;
        min-width: 0 !important;
        order: 1 !important;
    }
    .subheader-actions {
        order: 2 !important;
        width: auto !important;
        flex-shrink: 0 !important;
    }
    .subheader-list-btn {
        padding: 0.45rem 0.6rem !important;
        font-size: 0.8rem !important;
    }

    /* Mobile-Friendly Touch Pill Navigation */
    .safari-nav-scroll {
        display: flex !important;
        gap: 0.4rem !important;
        padding: 0.25rem 0.2rem 0.35rem !important;
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch !important;
        scrollbar-width: none !important;
        -ms-overflow-style: none !important;
    }
    .safari-nav-scroll::-webkit-scrollbar {
        display: none !important;
    }
    .safari-nav-item {
        flex-shrink: 0 !important;
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
        gap: 0.35rem !important;
        font-size: 0.8rem !important;
        font-weight: 600 !important;
        padding: 0.38rem 0.75rem !important;
        min-height: 34px !important;
        border-radius: 9999px !important;
        background: var(--bg-card) !important;
        border: 1px solid var(--border-color) !important;
        box-shadow: 0 1px 3px rgba(0,0,0,0.02) !important;
        color: var(--text-primary) !important;
        touch-action: manipulation !important;
        transition: transform 0.1s ease, background 0.15s ease !important;
    }
    .safari-nav-item:active {
        transform: scale(0.96) !important;
    }
    .safari-nav-item.active {
        background: var(--brand-safari-green) !important;
        color: #ffffff !important;
        border-color: var(--brand-safari-green) !important;
        box-shadow: 0 2px 8px rgba(26,66,49,0.22) !important;
        font-weight: 700 !important;
    }
    .safari-nav-item.active svg {
        color: #ffffff !important;
        stroke: #ffffff !important;
    }

    #main-content {
        padding: 1.25rem 0 !important;
    }

    /* General spacing & typography */
    h1 {
        font-size: 1.6rem !important;
        line-height: 1.25 !important;
    }
    h2 {
        font-size: 1.25rem !important;
        line-height: 1.3 !important;
    }
    h3 {
        font-size: 1.05rem !important;
    }

    /* Buttons mobile layout */
    .btn-safari, .btn-outline, .btn-gold {
        padding: 0.5rem 0.9rem;
        font-size: 0.85rem;
    }

    /* Responsive grid overrides to prevent horizontal blowouts */
    .mobile-stack {
        flex-direction: column !important;
        align-items: stretch !important;
    }
    .mobile-full-width {
        width: 100% !important;
        max-width: 100% !important;
    }

    /* Toast positioning */
    .toast-container {
        left: 0.75rem;
        right: 0.75rem;
        bottom: 1rem;
    }
    .safari-toast {
        width: 100%;
        box-sizing: border-box;
    }

    /* Settings Navigation Tabs */
    .settings-nav-tab {
        padding: 0.45rem 0.75rem !important;
        font-size: 0.82rem !important;
        white-space: nowrap !important;
    }
}

/* ==========================================================================
   Admin Console & Ingestion Manager Framework (Clean Modern Theme)
   ========================================================================== */

.admin-layout,
.admin-layout-body {
    background-color: #f8fafc !important;
    color: #0f172a !important;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif !important;
    -webkit-font-smoothing: antialiased;
}

.admin-container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding-left: 1rem;
    padding-right: 1rem;
    box-sizing: border-box;
}

/* Modern Admin Master Header */
.admin-master-header,
.admin-shell-header {
    background: #0f172a;
    color: #ffffff;
    border-bottom: 1px solid #1e293b;
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.12);
}

.admin-header-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 0.65rem;
    padding-bottom: 0.65rem;
}

.admin-brand {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    text-decoration: none;
    color: #ffffff;
}

.admin-brand-icon {
    border-radius: 6px;
    object-fit: contain;
}

.admin-brand-title {
    font-weight: 800;
    font-size: 1.05rem;
    color: #ffffff;
    letter-spacing: -0.2px;
}

.admin-brand-badge {
    background: #2563eb;
    color: #ffffff;
    font-size: 0.65rem;
    font-weight: 800;
    padding: 0.15rem 0.45rem;
    border-radius: 4px;
    margin-left: 0.35rem;
    letter-spacing: 0.05em;
    vertical-align: middle;
}

.admin-header-sep {
    height: 20px;
    width: 1px;
    background: #334155;
    margin: 0 0.5rem;
}

.admin-header-nav {
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.admin-nav-tab,
.admin-nav-pill {
    padding: 0.45rem 0.85rem;
    border-radius: 8px;
    font-size: 0.84rem;
    font-weight: 600;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    transition: all 0.15s ease;
    background: transparent;
    color: #94a3b8;
    border: 1px solid transparent;
    min-height: 38px;
}

.admin-nav-tab:hover,
.admin-nav-pill:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #ffffff;
}

.admin-nav-tab.active,
.admin-nav-pill.active {
    background: #1e293b;
    color: #ffffff;
    border-color: #334155;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.admin-header-btn {
    border-radius: 6px;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    transition: all 0.15s ease;
}

.admin-avatar-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #2563eb;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    border: 1.5px solid #3b82f6;
    transition: transform 0.15s ease;
}

.admin-avatar-btn:hover {
    transform: scale(1.05);
}

.admin-exit-btn {
    background: rgba(239, 68, 68, 0.12);
    color: #f87171;
    border: 1px solid rgba(239, 68, 68, 0.25);
    padding: 0.45rem 0.8rem;
    border-radius: 8px;
    font-size: 0.84rem;
    font-weight: 600;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    min-height: 38px;
    transition: background 0.15s ease, color 0.15s ease;
}
.admin-exit-btn:hover {
    background: rgba(239, 68, 68, 0.25);
    color: #ffffff;
}

.admin-mobile-toggle-btn {
    display: none;
    align-items: center;
    gap: 0.35rem;
    padding: 0.4rem 0.65rem;
    border-radius: 8px;
    background: #1e293b;
    border: 1px solid #334155;
    color: #f8fafc;
    cursor: pointer;
    font-size: 0.84rem;
    font-weight: 700;
    line-height: 1;
    transition: background 0.15s ease, border-color 0.15s ease;
}
.admin-mobile-toggle-btn:hover {
    background: #334155;
    border-color: #475569;
}

@media (max-width: 860px) {
    .hide-mobile {
        display: none !important;
    }
    .admin-mobile-toggle-btn {
        display: inline-flex !important;
    }
    .admin-header-inner {
        padding-top: 0.5rem;
        padding-bottom: 0.5rem;
    }
}
@media (min-width: 861px) {
    .admin-mobile-toggle-btn {
        display: none !important;
    }
}

/* Modern Admin Panel Cards */
.admin-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04);
    box-sizing: border-box;
}

.admin-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1.25rem;
}

.admin-card-title {
    font-size: 1.25rem;
    font-weight: 800;
    color: #0f172a;
    margin: 0 0 0.25rem 0;
    line-height: 1.3;
}

.admin-card-subtitle {
    font-size: 0.88rem;
    color: #64748b;
    margin: 0;
    line-height: 1.5;
}

/* Modern Stats Counter Cards */
.admin-stat-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 1.15rem 1.25rem;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.admin-stat-label {
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #64748b;
}

.admin-stat-value {
    font-size: 1.85rem;
    font-weight: 800;
    color: #0f172a;
    line-height: 1;
}

/* Touch-Friendly Action Buttons */
.admin-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-weight: 600;
    font-size: 0.9rem;
    border-radius: 8px;
    min-height: 44px;
    padding: 0.65rem 1.15rem;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.15s ease;
    border: 1px solid transparent;
    user-select: none;
    box-sizing: border-box;
    line-height: 1.25;
}

.admin-btn-primary {
    background: #2563eb;
    color: #ffffff;
    border-color: #1d4ed8;
}
.admin-btn-primary:hover {
    background: #1d4ed8;
    color: #ffffff;
}

.admin-btn-secondary {
    background: #ffffff;
    color: #334155;
    border-color: #cbd5e1;
}
.admin-btn-secondary:hover {
    background: #f8fafc;
    border-color: #94a3b8;
    color: #0f172a;
}

.admin-btn-danger {
    background: #ffffff;
    color: #dc2626;
    border-color: #fca5a5;
}
.admin-btn-danger:hover {
    background: #fef2f2;
    border-color: #ef4444;
    color: #b91c1c;
}

.admin-btn-success {
    background: #059669;
    color: #ffffff;
    border-color: #047857;
}
.admin-btn-success:hover {
    background: #047857;
    color: #ffffff;
}

.admin-btn-sm {
    min-height: 40px;
    padding: 0.45rem 0.85rem;
    font-size: 0.84rem;
}

/* Segmented Navigation Tabstrip */
.admin-tabs-nav {
    display: flex;
    gap: 0.5rem;
    overflow-x: auto;
    padding-bottom: 0.5rem;
    margin-bottom: 1.5rem;
    -webkit-overflow-scrolling: touch;
}

.admin-tab-btn {
    min-height: 44px;
    padding: 0.6rem 1rem;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.88rem;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    color: #475569;
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    white-space: nowrap;
    cursor: pointer;
    transition: all 0.15s ease;
    box-sizing: border-box;
}
.admin-tab-btn:hover {
    background: #f8fafc;
    color: #0f172a;
    border-color: #cbd5e1;
}
.admin-tab-btn.active {
    background: #0f172a;
    color: #ffffff;
    border-color: #0f172a;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.2);
}

/* Form Controls */
.admin-form-group {
    margin-bottom: 1.25rem;
}

.admin-label {
    display: block;
    font-size: 0.85rem;
    font-weight: 700;
    color: #334155;
    margin-bottom: 0.35rem;
}

.admin-input, .admin-select, .admin-textarea {
    width: 100%;
    min-height: 44px;
    padding: 0.65rem 0.85rem;
    border-radius: 8px;
    border: 1px solid #cbd5e1;
    background: #ffffff;
    color: #0f172a;
    font-size: 0.95rem;
    box-sizing: border-box;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
    font-family: inherit;
}
.admin-input:focus, .admin-select:focus, .admin-textarea:focus {
    border-color: #2563eb;
    outline: none;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

/* Status Badges */
.admin-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.76rem;
    font-weight: 700;
    padding: 0.25rem 0.65rem;
    border-radius: 999px;
    line-height: 1.2;
}
.admin-badge-success {
    background: #ecfdf5;
    color: #047857;
    border: 1px solid #a7f3d0;
}
.admin-badge-danger {
    background: #fff1f2;
    color: #be123c;
    border: 1px solid #fecdd3;
}
.admin-badge-warning {
    background: #fffbeb;
    color: #b45309;
    border: 1px solid #fde68a;
}
.admin-badge-info {
    background: #eff6ff;
    color: #1d4ed8;
    border: 1px solid #bfdbfe;
}
.admin-badge-primary {
    background: #0f172a;
    color: #ffffff;
    border: 1px solid #1e293b;
}
.admin-tab-btn.active .admin-badge {
    background: rgba(255, 255, 255, 0.2);
    color: #ffffff;
    border-color: rgba(255, 255, 255, 0.3);
}

/* Mobile Product Card vs Desktop Table */
.admin-mobile-product-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
}

.admin-mobile-product-header {
    display: flex;
    align-items: flex-start;
    gap: 0.85rem;
}

.admin-mobile-product-img {
    width: 56px;
    height: 56px;
    border-radius: 8px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    overflow: hidden;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.admin-mobile-product-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
    padding-top: 0.65rem;
    border-top: 1px solid #f1f5f9;
}

/* Mobile Bottom Navigation Dock */
.admin-mobile-dock {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: #0f172a;
    border-top: 1px solid #1e293b;
    z-index: 9000;
    padding: 0.4rem 0.5rem;
    justify-content: space-around;
    align-items: center;
    box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.2);
}

.admin-dock-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #94a3b8;
    text-decoration: none;
    font-size: 0.7rem;
    font-weight: 600;
    padding: 0.35rem 0.5rem;
    border-radius: 8px;
    min-width: 54px;
    min-height: 48px;
    transition: color 0.15s ease, background 0.15s ease;
    gap: 0.2rem;
}
.admin-dock-item.active,
.admin-dock-item:hover {
    color: #38bdf8;
    background: rgba(255, 255, 255, 0.08);
}

/* Responsive Overrides */
@media (max-width: 768px) {
    .admin-mobile-dock {
        display: flex !important;
    }
    .admin-nav-text {
        display: none !important;
    }
    .admin-layout-body main {
        padding-bottom: 5.5rem !important;
    }
    .admin-card {
        padding: 1.15rem 0.95rem;
        border-radius: 10px;
    }
    .admin-desktop-table {
        display: none !important;
    }
    .admin-mobile-cards-view {
        display: flex !important;
        flex-direction: column;
        gap: 0.85rem;
    }
    .admin-header-actions {
        width: 100%;
        display: grid !important;
        grid-template-columns: 1fr 1fr;
        gap: 0.5rem;
    }
    .admin-header-actions .admin-btn {
        width: 100%;
        padding: 0.5rem 0.75rem;
        font-size: 0.82rem;
    }
}

@media (min-width: 769px) {
    .admin-desktop-table {
        display: block !important;
    }
    .admin-mobile-cards-view {
        display: none !important;
    }
}

/* Modern Admin Table & Ingestion Utilities */
.admin-table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    background: #ffffff;
    margin-bottom: 1.25rem;
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    font-size: 0.88rem;
}

.admin-table th {
    background: #f8fafc;
    color: #64748b;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 0.85rem 1rem;
    border-bottom: 1px solid #e2e8f0;
    white-space: nowrap;
}

.admin-table td {
    padding: 0.85rem 1rem;
    border-bottom: 1px solid #f1f5f9;
    color: #334155;
    vertical-align: middle;
}

.admin-table tr:last-child td {
    border-bottom: none;
}

.admin-table tr:hover td {
    background: #f8fafc;
}

.admin-tag-btn {
    min-height: 36px;
    padding: 0.35rem 0.75rem;
    border-radius: 6px;
    border: 1px solid #cbd5e1;
    background: #ffffff;
    color: #334155;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    transition: all 0.15s ease;
}
.admin-tag-btn:hover {
    background: #f1f5f9;
    border-color: #94a3b8;
    color: #0f172a;
}

.admin-terminal {
    background: #0f172a;
    color: #f8fafc;
    border-radius: 10px;
    padding: 1.25rem;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 0.84rem;
    line-height: 1.6;
    max-height: 320px;
    overflow-y: auto;
    border: 1px solid #1e293b;
    box-sizing: border-box;
}

/* Printable Checklist */
@media print {
    .a11y-toolbar, header, footer, .no-print, .btn-safari {
        display: none !important;
    }
    body {
        background: #ffffff !important;
        color: #000000 !important;
    }
    .print-only {
        display: block !important;
    }
    .safari-card {
        border: 1px solid #000000 !important;
        box-shadow: none !important;
    }
}

/* Scout Tooltip Styling */
.scout-tooltip-wrapper {
    position: relative;
    display: inline-flex;
    align-items: center;
    cursor: help;
}

.scout-tooltip-wrapper .scout-tooltip-text {
    visibility: hidden;
    opacity: 0;
    width: max-content;
    background-color: var(--brand-safari-dark, #0f281e);
    color: #ffffff;
    text-align: center;
    border-radius: 6px;
    padding: 0.35rem 0.65rem;
    font-size: 0.78rem;
    font-weight: 600;
    position: absolute;
    z-index: 100;
    bottom: 125%;
    left: 50%;
    transform: translateX(-50%);
    box-shadow: 0 4px 12px rgba(0,0,0,0.18);
    transition: opacity 0.2s ease, visibility 0.2s ease;
    white-space: nowrap;
    pointer-events: none;
    border: 1px solid var(--brand-khaki, #c4ad8d);
}

.scout-tooltip-wrapper .scout-tooltip-text::after {
    content: "";
    position: absolute;
    top: 100%;
    left: 50%;
    margin-left: -5px;
    border-width: 5px;
    border-style: solid;
    border-color: var(--brand-safari-dark, #0f281e) transparent transparent transparent;
}

.scout-tooltip-wrapper:hover .scout-tooltip-text,
.scout-tooltip-wrapper:focus .scout-tooltip-text,
.scout-tooltip-wrapper:focus-within .scout-tooltip-text {
    visibility: visible;
    opacity: 1;
}

/* Modern Status Badges & Tags */
.badge-certified {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.75rem;
    font-weight: 700;
    padding: 0.2rem 0.55rem;
    border-radius: 6px;
    background: #e6f4ea;
    color: #137333;
    border: 1px solid #ceead6;
}

.badge-caution {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.75rem;
    font-weight: 700;
    padding: 0.2rem 0.55rem;
    border-radius: 6px;
    background: #fef7e0;
    color: #b06000;
    border: 1px solid #feebc8;
}

