/**
 * DialedRide Service Course - Custom Styles
 * 
 * This stylesheet extends Tailwind CSS with custom styles for:
 * - Alpine.js cloak behavior
 * - Typography and fonts
 * - Theme variables and dark/light mode
 * - UI components (scrollbars, cards, hero sections)
 * - Animations (pulse effects, database status indicators)
 * - Print styles for V5C reports
 * 
 * @file style.css
 * @version 1.0
 */

/* =============================================================================
   ALPINE.JS UTILITIES
   ============================================================================= */

/* Prevent flash of unstyled content during Alpine initialization */
[x-cloak] {
    display: none !important;
}

/* =============================================================================
   BASE TYPOGRAPHY
   ============================================================================= */

body {
    font-family: 'Inter', sans-serif;
    transition: background-color 0.3s, color 0.3s;
    overflow-x: hidden;
}

/* Display headings use Space Grotesk for modern, condensed aesthetic */
h1,
h2,
h3,
h4,
h5,
h6,
.font-display {
    font-family: 'Space Grotesk', sans-serif;
    letter-spacing: 0;
}

/* =============================================================================
   CSS CUSTOM PROPERTIES (Theme Variables)
   ============================================================================= */

:root {
    --color-primary: 212 255 0;
    /* Neon green - default theme */
    --color-accent: 178 230 50;
    /* Accent complement */
}

/* =============================================================================
   DARK MODE STYLES (Default)
   ============================================================================= */

.dark body {
    background-color: #0a0a0a;
    color: #e5e5e5;
}

/* =============================================================================
   LIGHT MODE STYLES & OVERRIDES
   ============================================================================= */

html:not(.dark) body {
    background-color: #f3f4f6;
    color: #111827;
}

/* High contrast text overrides for light mode readability */
html:not(.dark) .text-white {
    color: #111827 !important;
}

html:not(.dark) .text-gray-300,
html:not(.dark) .text-gray-400,
html:not(.dark) .text-gray-500 {
    color: #374151 !important;
}

/* Background overrides for light mode surfaces */
html:not(.dark) .bg-brand-black {
    background-color: #ffffff !important;
    border-color: #d1d5db !important;
}

html:not(.dark) .bg-white\/5 {
    background-color: rgba(0, 0, 0, 0.05) !important;
    border-color: rgba(0, 0, 0, 0.1) !important;
}

html:not(.dark) .border-white\/5,
html:not(.dark) .border-white\/10 {
    border-color: #d1d5db !important;
}

/* Overrides for hardcoded dark mode colors in kinemetric.html */
html:not(.dark) .bg-\[\#111\],
html:not(.dark) .bg-\[\#0F0F0F\],
html:not(.dark) .bg-\[\#151515\],
html:not(.dark) .bg-\[\#0D0D0D\],
html:not(.dark) .bg-\[\#0a0a0a\],
html:not(.dark) .bg-\[\#0d0d0d\],
html:not(.dark) .bg-\[\#050505\] {
    background-color: #ffffff !important;
    color: #111827 !important;
    border-color: #e5e7eb !important;
}

/* Surface/Card overrides for light mode */
html:not(.dark) .bg-\[\#1a1a1a\] {
    background-color: #f9fafb !important;
    /* gray-50 */
    border-color: #e5e7eb !important;
    color: #111827 !important;
}

/* Text color overrides */
html:not(.dark) .text-\[\#ffffff\] {
    color: #111827 !important;
}

html:not(.dark) .text-\[\#e5e7eb\] {
    color: #4b5563 !important;
    /* gray-600 */
}

html:not(.dark) .text-\[\#d4af37\] {
    color: #854d0e !important;
    /* Darker gold/bronze for contrast on white */
}

/* Fix unreadable neon green text on white backgrounds */
html:not(.dark) .text-brand-gold {
    color: #4d7c0f !important;
    /* Darker lime-700 for readability */
}

/* Ensure Hero text remains readable (light) on the dark hero background images */
html:not(.dark) .hero-text.text-\[\#ffffff\],
html:not(.dark) .hero-text.text-\[\#e5e7eb\] {
    color: #ffffff !important;
}

/* Keep the branding neon in the hero section even in light mode */
html:not(.dark) .hero-text.text-brand-gold {
    color: rgb(212, 255, 0) !important;
}

/* Ensure select dropdowns are legible in light mode */
html:not(.dark) select option {
    background-color: #ffffff !important;
    color: #000000 !important;
}

/* Ensure select dropdowns are legible in dark mode */
.dark select option {
    background-color: #121212 !important;
    color: #ffffff !important;
}

/* =============================================================================
   INPUTS & PANELS LIGHT MODE OVERRIDES
   ============================================================================= */

/* Force all black backgrounds to white/light-gray in light mode */
html:not(.dark) .bg-black,
html:not(.dark) .bg-\[\#0a0a0a\] {
    background-color: #ffffff !important;
    color: #111827 !important;
    border-color: #d1d5db !important;
}

/* Ensure inputs with bg-black become white inputs with dark text */
html:not(.dark) input.bg-black,
html:not(.dark) select.bg-black,
html:not(.dark) textarea.bg-black {
    background-color: #ffffff !important;
    color: #111827 !important;
    border-color: #d1d5db !important;
}

/* Semi-transparent black panels (bg-black/30, bg-black/50) -> Light Gray panels */
html:not(.dark) .bg-black\/30,
html:not(.dark) .bg-black\/40,
html:not(.dark) .bg-black\/50 {
    background-color: #e5e7eb !important;
    /* gray-200 */
    color: #111827 !important;
    border-color: #d1d5db !important;
}

/* Fix borders that were white/20 -> gray-300 */
html:not(.dark) .border-white\/20,
html:not(.dark) .border-white\/10,
html:not(.dark) .border-white\/5 {
    border-color: #d1d5db !important;
}

/* Fix "Brand Gold" text inside these now-light panels to be dark olive for readability */
html:not(.dark) .bg-black\/30 .text-brand-gold,
html:not(.dark) .bg-black\/50 .text-brand-gold {
    color: #4d7c0f !important;
}

/* =============================================================================
   STATUS & ALERT LIGHT MODE OVERRIDES
   ============================================================================= */

/* Fix Brand Accent (Secondary Neon) for light mode */
html:not(.dark) .text-brand-accent {
    color: #4d7c0f !important;
}

/* STATUS COLORS: Overrides for readability on white backgrounds */

/* Green (Success/Good) */
html:not(.dark) .text-green-400 {
    color: #15803d !important;
    /* green-700 */
}

html:not(.dark) .bg-green-900\/20 {
    background-color: #dcfce7 !important;
    /* green-100 */
    border-color: #86efac !important;
    /* green-300 */
}

html:not(.dark) .text-green-200 {
    color: #14532d !important;
    /* green-900 */
}

/* Yellow (Warning/Caution) */
html:not(.dark) .text-yellow-400 {
    color: #b45309 !important;
    /* amber-700 */
}

html:not(.dark) .bg-yellow-900\/20 {
    background-color: #fef3c7 !important;
    /* amber-100 */
    border-color: #fcd34d !important;
    /* amber-300 */
}

html:not(.dark) .text-yellow-200 {
    color: #78350f !important;
    /* amber-900 */
}

/* Red (Danger/Bad) */
html:not(.dark) .text-red-400 {
    color: #b91c1c !important;
    /* red-700 */
}

html:not(.dark) .bg-red-900\/20 {
    background-color: #fee2e2 !important;
    /* red-100 */
    border-color: #fca5a5 !important;
    /* red-300 */
}

html:not(.dark) .text-red-200 {
    color: #7f1d1d !important;
    /* red-900 */
}

/* =============================================================================
   BRAND OPACITY OVERRIDES (Fix for "Barely Visible" Text)
   ============================================================================= */

/* Fix bg-brand-gold/10 -> Very light lime background */
html:not(.dark) .bg-brand-gold\/10 {
    background-color: #f7fee7 !important;
    /* lime-50 */
    border-color: #d9f99d !important;
    /* lime-200 */
}

/* Fix text-brand-gold/50 -> Solid Dark Olive (Guide checkmarks) */
html:not(.dark) .text-brand-gold\/50 {
    color: #65a30d !important;
    /* lime-600 */
}

/* Fix text-brand-gold/60 -> Solid Dark Olive */
html:not(.dark) .text-brand-gold\/60 {
    color: #3f6212 !important;
    /* lime-800 */
}

/* Fix text-brand-gold/70 -> Solid Dark Olive (Chart legend "Trend Lines") */
html:not(.dark) .text-brand-gold\/70 {
    color: #4d7c0f !important;
    /* lime-700 */
}

/* Fix border-brand-gold/20 -> Solid Lime Border */
html:not(.dark) .border-brand-gold\/20 {
    border-color: #bef264 !important;
    /* lime-300 */
}

/* Fix border-brand-gold/20 -> Solid Lime Border */
html:not(.dark) .border-brand-gold\/20 {
    border-color: #bef264 !important;
    /* lime-300 */
}

/* =============================================================================
   WARNING & ALERT OVERRIDES (Fix for Red/Danger Labels)
   ============================================================================= */

/* Fix heavy red backgrounds (bg-red-600) -> Light Red for readability with dark text */
html:not(.dark) .bg-red-600 {
    background-color: #fee2e2 !important;
    /* red-100 */
    border: 1px solid #fca5a5 !important;
    /* red-300 border for definition */
}

/* Fix semi-transparent red backgrounds (bg-red-900/40, /60) -> Light Red */
html:not(.dark) .bg-red-900\/40,
html:not(.dark) .bg-red-900\/60,
html:not(.dark) .bg-red-900\/30 {
    background-color: #fee2e2 !important;
    /* red-100 */
    border-color: #fca5a5 !important;
    /* red-300 */
    color: #991b1b !important;
    /* red-800 */
}

/* Ensure borders on these alerts are visible */
html:not(.dark) .border-red-500\/60,
html:not(.dark) .border-red-500\/50 {
    border-color: #fca5a5 !important;
    /* red-300 */
}

/* =============================================================================
   THE CLINIC OVERRIDES
   ============================================================================= */

/* Fix bg-brand-surface (The Clinic Buttons) -> Light Gray surface */
html:not(.dark) .bg-brand-surface {
    background-color: #f3f4f6 !important;
    /* gray-100 */
    border-color: #e5e7eb !important;
    /* gray-200 */
    color: #374151 !important;
    /* gray-700 */
}

/* Fix hover state for Clinic buttons */
html:not(.dark) .hover\:bg-white\/5:hover {
    background-color: #e5e7eb !important;
    /* gray-200 */
    color: #111827 !important;
    /* gray-900 */
}

/* Fix hover state for Clinic buttons */
html:not(.dark) .hover\:bg-white\/5:hover {
    background-color: #e5e7eb !important;
    /* gray-200 */
    color: #111827 !important;
    /* gray-900 */
}

/* =============================================================================
   ANALYST REPORT CARD OVERRIDES (Fix for Gradient Backgrounds)
   ============================================================================= */

/* Green Report (Progression) */
html:not(.dark) .from-green-900\/50 {
    background: #dcfce7 !important;
    /* green-100 */
    --tw-gradient-from: #dcfce7 !important;
    --tw-gradient-to: #dcfce7 !important;
    border-color: #86efac !important;
    /* green-300 */
}

/* Orange Report (Aero Regression/Warning) */
html:not(.dark) .from-orange-900\/50 {
    background: #ffedd5 !important;
    /* orange-100 */
    --tw-gradient-from: #ffedd5 !important;
    --tw-gradient-to: #ffedd5 !important;
    border-color: #fdba74 !important;
    /* orange-300 */
}

/* Red Report (Regression Detected) */
html:not(.dark) .from-red-900\/50 {
    background: #fee2e2 !important;
    /* red-100 */
    --tw-gradient-from: #fee2e2 !important;
    --tw-gradient-to: #fee2e2 !important;
    border-color: #fca5a5 !important;
    /* red-300 */
}

/* Blue Report (Steady) */
html:not(.dark) .from-blue-900\/50 {
    background: #dbeafe !important;
    /* blue-100 */
    --tw-gradient-from: #dbeafe !important;
    --tw-gradient-to: #dbeafe !important;
    border-color: #93c5fd !important;
    /* blue-300 */
}

/* Default/Gray Report */
html:not(.dark) .from-gray-800\/50 {
    background: #f3f4f6 !important;
    /* gray-100 */
    --tw-gradient-from: #f3f4f6 !important;
    --tw-gradient-to: #f3f4f6 !important;
    border-color: #e5e7eb !important;
    /* gray-200 */
}

/* =============================================================================
   HERO SECTION STYLES
   ============================================================================= */

/* Text shadow for hero overlay text - improves readability on images */
.hero-text {
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.8), 0 10px 40px rgba(0, 0, 0, 0.8);
}

/* =============================================================================
   HORIZONTAL SCROLLING & CARDS
   ============================================================================= */

.scrolling-wrapper {
    -webkit-overflow-scrolling: touch;
    /* Smooth scrolling on iOS */
    scroll-snap-type: x mandatory;
}

.card-snap {
    scroll-snap-align: start;
}

/* =============================================================================
   CUSTOM SCROLLBAR STYLES
   ============================================================================= */

::-webkit-scrollbar {
    height: 4px;
}

::-webkit-scrollbar-track {
    background: #0a0a0a;
}

::-webkit-scrollbar-thumb {
    background: #333;
    border-radius: 2px;
}

/* =============================================================================
   ANIMATIONS - UI Feedback Effects
   ============================================================================= */

/* Subtle pulse animation for CTA buttons (e.g., Customise button) */
@keyframes pulse-subtle {

    0%,
    100% {
        transform: scale(1);
        box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    }

    50% {
        transform: scale(1.05);
        box-shadow: 0 10px 15px -3px rgba(212, 255, 0, 0.3), 0 4px 6px -2px rgba(212, 255, 0, 0.2);
    }
}

.animate-pulse-subtle {
    animation: pulse-subtle 2s ease-in-out infinite;
}

/* Database status indicator - green pulse effect for update notifications */
@keyframes db-pulse {

    0%,
    100% {
        box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.7);
    }

    50% {
        box-shadow: 0 0 0 6px rgba(34, 197, 94, 0);
    }
}

.animate-db-pulse {
    animation: db-pulse 2s ease-in-out infinite;
}

/* =============================================================================
   HOME COMMAND SURFACE
   ============================================================================= */

.dr-home-hero {
    isolation: isolate;
}

.dr-home-hero__shade {
    background:
        linear-gradient(90deg, rgba(0, 0, 0, 0.88) 0%, rgba(0, 0, 0, 0.58) 34%, rgba(0, 0, 0, 0.2) 68%),
        linear-gradient(180deg, rgba(0, 0, 0, 0.72) 0%, transparent 34%, rgba(0, 0, 0, 0.92) 100%);
}

.dr-home-topbar {
    gap: 1rem;
}

.dr-home-brand,
.dr-home-command-bar,
.dr-home-profile {
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: var(--dr-radius-xl);
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.02)),
        rgba(5, 7, 10, 0.82);
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.34);
}

.dr-home-brand {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    min-width: 12rem;
    padding: 0.55rem 0.75rem;
    backdrop-filter: blur(18px);
}

.dr-home-brand__mark {
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    width: 2.6rem;
    height: 2.6rem;
    border-radius: var(--dr-radius-md);
    background: rgb(var(--color-primary));
    color: #050505;
    font-weight: 900;
}

.dr-home-command-bar {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.45rem;
    backdrop-filter: blur(18px);
}

.dr-home-nav-item {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    min-height: 2.5rem;
    padding: 0.7rem 0.85rem;
    border-radius: var(--dr-radius-md);
    color: rgba(255, 255, 255, 0.82);
    font-size: 0.68rem;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    transition: background-color 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.dr-home-nav-item:hover,
.dr-home-nav-item[aria-expanded="true"] {
    transform: translateY(-1px);
    background: rgb(var(--color-primary));
    color: #050505;
}

.dr-home-profile {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.5rem 0.65rem;
    backdrop-filter: blur(18px);
}

.dr-home-icon-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.4rem;
    height: 2.4rem;
    border-radius: var(--dr-radius-md);
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.dr-home-icon-button:hover {
    background: rgb(var(--color-primary));
    color: #050505;
}

.dr-home-hero__content {
    width: min(100%, 68rem);
    padding: 11rem 2rem 0;
}

.dr-home-eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 0.7rem;
    color: rgb(var(--color-primary));
    font-size: 0.74rem;
    font-weight: 900;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    text-shadow: 0 12px 30px rgba(0, 0, 0, 0.55);
}

.dr-home-eyebrow::before {
    content: '';
    width: 2rem;
    height: 2px;
    background: currentColor;
}

.dr-home-hero__title {
    max-width: 52rem;
    margin-top: 1rem;
    color: #fff;
    font-family: 'Space Grotesk', sans-serif;
    font-size: clamp(3.25rem, 8vw, 6.7rem);
    font-weight: 900;
    line-height: 0.86;
    text-transform: uppercase;
    text-shadow: 0 18px 48px rgba(0, 0, 0, 0.68);
}

.dr-home-hero__copy {
    max-width: 38rem;
    margin-top: 2rem;
    padding-left: 1.15rem;
    border-left: 2px solid rgb(var(--color-primary));
    color: rgba(255, 255, 255, 0.82);
    font-size: 1rem;
    line-height: 1.75;
    text-shadow: 0 10px 28px rgba(0, 0, 0, 0.58);
}

.dr-home-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.8rem;
    margin-top: 2rem;
}

.dr-home-primary-action,
.dr-home-secondary-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.7rem;
    min-height: 3.25rem;
    padding: 0.95rem 1.2rem;
    border-radius: var(--dr-radius-md);
    font-size: 0.7rem;
    font-weight: 900;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    transition: transform 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}

.dr-home-primary-action {
    background: rgb(var(--color-primary));
    color: #050505;
    box-shadow: 0 22px 48px rgb(var(--color-primary) / 0.2);
}

.dr-home-secondary-action {
    border: 1px solid rgba(255, 255, 255, 0.16);
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
    backdrop-filter: blur(12px);
}

.dr-home-primary-action:hover,
.dr-home-secondary-action:hover {
    transform: translateY(-1px);
}

.dr-home-slide-dots {
    display: flex;
    gap: 0.45rem;
}

.dr-home-slide-dot {
    height: 4px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.28);
    transition: width 0.4s ease, background-color 0.2s ease;
}

.dr-home-slide-dot:hover {
    background: rgba(255, 255, 255, 0.5);
}

.dr-home-slide-dot--active {
    background: rgb(var(--color-primary));
}

@media (max-width: 1180px) {
    .dr-home-command-bar {
        max-width: 58vw;
        overflow-x: auto;
    }

    .dr-home-nav-item {
        white-space: nowrap;
    }
}

@media (max-width: 900px) {
    .dr-home-topbar {
        align-items: flex-start;
        padding: 1rem;
    }

    .dr-home-brand {
        min-width: 0;
        max-width: calc(100vw - 8rem);
    }

    .dr-home-profile {
        padding: 0.45rem;
    }

    .dr-home-hero__content {
        padding: 8.5rem 1rem 0;
    }

    .dr-home-hero__title {
        font-size: clamp(2.8rem, 13vw, 4.6rem);
    }

}

@media (max-width: 560px) {
    .dr-home-brand__mark {
        width: 2.35rem;
        height: 2.35rem;
    }

    .dr-home-actions {
        align-items: stretch;
        flex-direction: column;
    }

    .dr-home-primary-action,
    .dr-home-secondary-action {
        width: 100%;
    }

}

/* =============================================================================
   PRINT STYLES - V5C Report & Fit Lab PDF Generation
   ============================================================================= */

/* Remove browser default headers/footers by setting page margins to 0 */
@page {
    margin: 0;
    size: A4 portrait;
}

@media print {

    /* Force all colors and backgrounds to print */
    * {
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
        color-adjust: exact !important;
    }

    /* Hide EVERYTHING in body by default */
    body>* {
        display: none !important;
    }

    /* But show the Alpine app container (needed for the document view) */
    body>div[x-data] {
        display: block !important;
    }

    /* Hide everything INSIDE the app container by default */
    body>div[x-data]>* {
        display: none !important;
    }

    /* 
     * Show the document modal containers ONLY if Alpine hasn't hidden them.
     * Alpine sets style="display: none;" when x-show is false.
     * We use :not([style*="display: none"]) to respect that.
     */
    body>div[x-data]>div[x-show="showDocumentView"]:not([style*="display: none"]),
    body>div[x-data]>div[x-show="showFitLabPDF"]:not([style*="display: none"]) {
        display: flex !important;
        position: static !important;
        background: transparent !important;
    }

    /* Base print overrides */
    body {
        background-color: white !important;
        color: black !important;
        margin: 0 !important;
        padding: 0 !important;
    }

    /* Show the V5C document */
    #v5c-document {
        display: block !important;
        position: relative !important;
        left: auto !important;
        top: auto !important;
        min-height: auto !important;
        height: auto !important;
        max-width: 100% !important;
        width: 100% !important;
        margin: 0 !important;
        padding: 15mm !important;
        box-shadow: none !important;
        overflow: visible !important;
        background: white !important;
        color: black !important;
    }

    /* Show the Fit Lab document */
    #fitlab-document {
        display: block !important;
        position: relative !important;
        left: auto !important;
        top: auto !important;
        min-height: auto !important;
        height: auto !important;
        max-width: 100% !important;
        width: 100% !important;
        margin: 0 !important;
        padding: 10mm !important;
        box-shadow: none !important;
        overflow: visible !important;
        background: white !important;
        color: black !important;
    }

    /* Keep report sections together when possible */
    #v5c-document>div,
    #fitlab-document>div {
        page-break-inside: avoid;
    }

    /* Allow receipt grid to break across pages for long lists */
    #v5c-document .grid-cols-4 {
        page-break-inside: auto;
    }

    /* Keep individual items together */
    #v5c-document .grid-cols-4>div,
    #fitlab-document .grid-cols-3>div,
    #fitlab-document .grid-cols-2>div {
        page-break-inside: avoid;
    }

    /* ===========================================
       FIT LAB DOCUMENT - Explicit Print Colors
       =========================================== */

    /* Gray backgrounds for cards */
    #fitlab-document .bg-gray-50 {
        background-color: #f5f5f5 !important;
    }

    /* Status indicator colors - Green (Perfect) */
    #fitlab-document .border-green-600 {
        border-color: #16a34a !important;
    }

    #fitlab-document .bg-green-600 {
        background-color: #16a34a !important;
    }

    #fitlab-document .bg-green-50 {
        background-color: #f0fdf4 !important;
    }

    /* Status indicator colors - Yellow (Warning) */
    #fitlab-document .border-yellow-600 {
        border-color: #ca8a04 !important;
    }

    #fitlab-document .bg-yellow-600 {
        background-color: #ca8a04 !important;
    }

    #fitlab-document .bg-yellow-50 {
        background-color: #fefce8 !important;
    }

    /* Status indicator colors - Red (Danger/Mismatch) */
    #fitlab-document .border-red-600 {
        border-color: #dc2626 !important;
    }

    #fitlab-document .bg-red-600 {
        background-color: #dc2626 !important;
    }

    #fitlab-document .bg-red-50 {
        background-color: #fef2f2 !important;
    }

    /* Saddle height box - Blue */
    #fitlab-document .bg-blue-50 {
        background-color: #eff6ff !important;
    }

    #fitlab-document .border-blue-200 {
        border-color: #bfdbfe !important;
    }

    /* Text colors for print */
    #fitlab-document .text-green-600 {
        color: #16a34a !important;
    }

    #fitlab-document .text-red-600 {
        color: #dc2626 !important;
    }

    #fitlab-document .text-blue-800 {
        color: #1e40af !important;
    }

    #fitlab-document .text-blue-900 {
        color: #1e3a8a !important;
    }

    #fitlab-document .text-blue-600 {
        color: #2563eb !important;
    }

    #fitlab-document .text-red-800 {
        color: #991b1b !important;
    }

    #fitlab-document .text-red-900 {
        color: #7f1d1d !important;
    }

    /* Ensure borders print */
    #fitlab-document .border,
    #fitlab-document .border-2 {
        border-style: solid !important;
    }

    #fitlab-document .border-gray-200 {
        border-color: #e5e5e5 !important;
    }

    #fitlab-document .border-gray-300 {
        border-color: #d4d4d4 !important;
    }

    #fitlab-document .border-black {
        border-color: #000000 !important;
    }

    #fitlab-document .border-red-200 {
        border-color: #fecaca !important;
    }

    /* Hide the modal toolbar during print */
    .no-print {
        display: none !important;
    }
}

/* =============================================================================
   MOBILE & TABLET RESPONSIVE STYLES
   ============================================================================= */

/* =============================================================================
   DIALEDRIDE DESIGN SYSTEM LAYER
   ============================================================================= */

:root {
    --dr-bg: #06080b;
    --dr-surface: rgba(14, 18, 24, 0.9);
    --dr-surface-strong: rgba(18, 23, 30, 0.96);
    --dr-surface-soft: rgba(255, 255, 255, 0.04);
    --dr-border: rgba(255, 255, 255, 0.1);
    --dr-border-strong: rgb(var(--color-primary) / 0.24);
    --dr-text: #f5f7fa;
    --dr-muted: #a6afbb;
    --dr-subtle: #6c7582;
    --dr-input-bg: rgba(5, 7, 10, 0.8);
    --dr-shadow: 0 24px 60px rgba(0, 0, 0, 0.34);
    --dr-radius-xl: 12px;
    --dr-radius-lg: 10px;
    --dr-radius-md: 8px;
    --dr-radius-sm: 6px;
}

html:not(.dark) {
    --dr-bg: #f3f4f6;
    --dr-surface: rgba(255, 255, 255, 0.96);
    --dr-surface-strong: rgba(255, 255, 255, 1);
    --dr-surface-soft: rgba(17, 24, 39, 0.04);
    --dr-border: rgba(17, 24, 39, 0.12);
    --dr-border-strong: rgba(77, 124, 15, 0.22);
    --dr-text: #111827;
    --dr-muted: #4b5563;
    --dr-subtle: #6b7280;
    --dr-input-bg: rgba(255, 255, 255, 0.92);
    --dr-shadow: 0 16px 34px rgba(15, 23, 42, 0.08);
}

/* =============================================================================
   BIOAUDIT PROFESSIONAL THEME
   ============================================================================= */

html.bioaudit-theme {
    --color-primary: 212 175 55;
    --color-accent: 166 138 79;
    --dr-bg: #080908;
    --dr-surface: rgba(19, 20, 19, 0.95);
    --dr-surface-strong: rgba(24, 25, 24, 0.98);
    --dr-surface-soft: rgba(234, 225, 210, 0.055);
    --dr-border: rgba(234, 225, 210, 0.12);
    --dr-border-strong: rgba(212, 175, 55, 0.34);
    --dr-text: #f6f1e8;
    --dr-muted: #b9b0a2;
    --dr-subtle: #837a6d;
    --dr-input-bg: rgba(10, 11, 10, 0.84);
    --dr-shadow: 0 24px 60px rgba(0, 0, 0, 0.36);
}

html.bioaudit-theme body {
    background:
        linear-gradient(180deg, rgba(32, 28, 21, 0.96), var(--dr-bg) 38%),
        var(--dr-bg);
    color: var(--dr-text);
}

html.bioaudit-theme .dr-panel,
html.bioaudit-theme .dr-subpanel,
html.bioaudit-theme .dr-metric,
html.bioaudit-theme .dr-empty-state {
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.025), transparent 36%),
        var(--dr-surface);
}

html.bioaudit-theme .dr-button--primary,
html.bioaudit-theme .btn-primary {
    background-color: rgb(var(--color-primary));
    background-image: linear-gradient(135deg, rgb(var(--color-primary)), rgb(var(--color-accent)));
    box-shadow: 0 18px 40px rgb(var(--color-primary) / 0.16);
}

html.bioaudit-theme .dr-button--primary:hover:not(:disabled),
html.bioaudit-theme .btn-primary:hover:not(:disabled) {
    box-shadow: 0 22px 46px rgb(var(--color-primary) / 0.22);
}

html.bioaudit-theme ::selection {
    background: rgb(var(--color-primary));
    color: #080908;
}

/* BioAudit: Subtle top-of-page accent line to replace the DialedRide neon strip */
html.bioaudit-theme body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(
        90deg,
        transparent 0%,
        rgba(212, 175, 55, 0.45) 20%,
        rgba(212, 175, 55, 0.75) 50%,
        rgba(212, 175, 55, 0.45) 80%,
        transparent 100%
    );
    z-index: 9999;
    pointer-events: none;
}

/* BioAudit: Stronger visual weight for the product name in the header */
html.bioaudit-theme .font-condensed {
    letter-spacing: 0.01em;
}

html.bioaudit-theme:not(.dark) {
    --dr-bg: #f7f3eb;
    --dr-surface: rgba(255, 255, 255, 0.94);
    --dr-surface-strong: #ffffff;
    --dr-surface-soft: rgba(120, 91, 48, 0.075);
    --dr-border: rgba(75, 58, 33, 0.16);
    --dr-border-strong: rgba(133, 77, 14, 0.28);
    --dr-text: #1f2933;
    --dr-muted: #5f5549;
    --dr-subtle: #837466;
    --dr-input-bg: rgba(255, 255, 255, 0.96);
    --dr-shadow: 0 16px 36px rgba(62, 45, 24, 0.1);
}

html.bioaudit-theme:not(.dark) body {
    background:
        linear-gradient(180deg, rgba(255, 251, 242, 0.98), var(--dr-bg) 42%),
        var(--dr-bg) !important;
    color: var(--dr-text);
}

html.bioaudit-theme:not(.dark) body::before {
    background: linear-gradient(
        90deg,
        transparent 0%,
        rgba(133, 77, 14, 0.22) 20%,
        rgba(133, 77, 14, 0.48) 50%,
        rgba(133, 77, 14, 0.22) 80%,
        transparent 100%
    );
}

html.bioaudit-theme:not(.dark) .text-brand-gold {
    color: #854d0e !important;
}

html.bioaudit-theme:not(.dark) [class*="text-white/"] {
    color: var(--dr-muted) !important;
}

html.bioaudit-theme:not(.dark) .text-white,
html.bioaudit-theme:not(.dark) .hover\:text-white:hover {
    color: var(--dr-text) !important;
}

html.bioaudit-theme:not(.dark) .bg-black,
html.bioaudit-theme:not(.dark) .bg-\[\#080908\] {
    background-color: var(--dr-surface-strong) !important;
}

html.bioaudit-theme:not(.dark) .bg-black\/15,
html.bioaudit-theme:not(.dark) .bg-black\/20,
html.bioaudit-theme:not(.dark) .bg-black\/25,
html.bioaudit-theme:not(.dark) .bg-black\/30,
html.bioaudit-theme:not(.dark) .bg-black\/40,
html.bioaudit-theme:not(.dark) .bg-black\/50 {
    background-color: rgba(255, 255, 255, 0.72) !important;
}

html.bioaudit-theme:not(.dark) [class*="bg-white/"] {
    background-color: rgba(75, 58, 33, 0.055) !important;
}

html.bioaudit-theme:not(.dark) [class*="border-white/"] {
    border-color: var(--dr-border) !important;
}

html.bioaudit-theme:not(.dark) input,
html.bioaudit-theme:not(.dark) select,
html.bioaudit-theme:not(.dark) textarea {
    color: var(--dr-text) !important;
    background-color: var(--dr-input-bg) !important;
    color-scheme: light !important;
}

html.bioaudit-theme:not(.dark) select option {
    background-color: #ffffff !important;
    color: #1f2933 !important;
}


html.bioaudit-theme:not(.dark) input::placeholder,
html.bioaudit-theme:not(.dark) textarea::placeholder {
    color: rgba(95, 85, 73, 0.7);
}

html.bioaudit-theme:not(.dark) .text-yellow-100,
html.bioaudit-theme:not(.dark) [class*="text-yellow-100/"] {
    color: #78350f !important;
}

html.bioaudit-theme:not(.dark) .text-green-100,
html.bioaudit-theme:not(.dark) [class*="text-green-100/"] {
    color: #14532d !important;
}

html.bioaudit-theme:not(.dark) .text-red-200,
html.bioaudit-theme:not(.dark) [class*="text-red-200/"] {
    color: #7f1d1d !important;
}

html:not(.dark) .dr-status--success {
    border-color: #86efac;
    background: #dcfce7;
    color: #166534;
}

html:not(.dark) .dr-status--info {
    border-color: #7dd3fc;
    background: #e0f2fe;
    color: #075985;
}

html:not(.dark) .dr-status--warning {
    border-color: #fcd34d;
    background: #fef3c7;
    color: #92400e;
}

html:not(.dark) .dr-status--danger {
    border-color: #fca5a5;
    background: #fee2e2;
    color: #991b1b;
}

html:not(.dark) .dr-status--neutral {
    border-color: #d1d5db;
    background: #f3f4f6;
    color: #4b5563;
}

html:not(.dark) .dr-bike-media::after {
    background: linear-gradient(180deg, transparent, rgba(255, 255, 255, 0.96));
}

.dr-shell {
    position: relative;
    overflow: hidden;
    border: 1px solid var(--dr-border);
    border-radius: var(--dr-radius-xl);
    background:
        linear-gradient(115deg, rgb(var(--color-primary) / 0.1), transparent 34%),
        linear-gradient(180deg, rgb(255 255 255 / 0.055), transparent 42%),
        var(--dr-surface-strong);
    box-shadow: var(--dr-shadow);
}

.dr-panel,
.dr-subpanel,
.dr-metric,
.dr-empty-state {
    border: 1px solid var(--dr-border);
    background: var(--dr-surface);
    box-shadow: var(--dr-shadow);
}

.dr-panel {
    border-radius: var(--dr-radius-lg);
}

.dr-subpanel,
.dr-metric,
.dr-empty-state {
    border-radius: var(--dr-radius-md);
}

.dr-metric--fit-result {
    min-height: 7.35rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.dr-metric.p-4 {
    min-height: 7.35rem;
    height: 8.15rem;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
}

.dr-metric--fit-result .dr-metric-note {
    min-height: 1.6rem;
    display: flex;
    align-items: flex-start;
}

.dr-metric.p-4 > :first-child {
    min-height: 2.35rem;
    display: flex;
    align-items: flex-start;
}

.dr-fit-result-header {
    min-height: 5.35rem;
}

@media (max-width: 639px) {
    .dr-fit-result-header {
        min-height: 0;
    }
}

.dr-panel--accent {
    border-color: var(--dr-border-strong);
    box-shadow: 0 26px 70px rgba(0, 0, 0, 0.35), 0 0 0 1px rgb(var(--color-primary) / 0.08);
}

.dr-panel--success {
    border-color: rgba(74, 222, 128, 0.25);
    background: linear-gradient(180deg, rgba(74, 222, 128, 0.1), var(--dr-surface));
}

.dr-panel--info {
    border-color: rgba(56, 189, 248, 0.24);
    background: linear-gradient(180deg, rgba(56, 189, 248, 0.08), var(--dr-surface));
}

.dr-panel--warning {
    border-color: rgba(251, 191, 36, 0.24);
    background: linear-gradient(180deg, rgba(251, 191, 36, 0.08), var(--dr-surface));
}

.dr-panel--danger {
    border-color: rgba(248, 113, 113, 0.3);
    background: linear-gradient(180deg, rgba(248, 113, 113, 0.1), var(--dr-surface));
}

.dr-panel--required {
    border-color: rgba(248, 113, 113, 0.56) !important;
    box-shadow: var(--dr-shadow), 0 0 0 1px rgba(248, 113, 113, 0.16);
}

.dr-required-mark {
    margin-left: 0.35rem;
    color: #f87171;
    font-weight: 900;
}

.dr-workflow-step--required {
    border-color: rgba(248, 113, 113, 0.48) !important;
    background: rgba(248, 113, 113, 0.08);
    box-shadow: 0 0 0 1px rgba(248, 113, 113, 0.1);
}

.dr-next-action {
    border-left: 4px solid rgba(255, 255, 255, 0.22);
    background: rgba(255, 255, 255, 0.025);
}

.dr-next-action--high {
    border-left-color: rgb(var(--color-primary) / 0.65);
    background: rgb(var(--color-primary) / 0.06);
}

.dr-next-action--medium,
.dr-next-action--low {
    border-left-color: rgb(var(--color-primary) / 0.35);
}

.dr-next-action--warning {
    border-left-color: rgba(251, 191, 36, 0.78);
    background: rgba(251, 191, 36, 0.07);
}

.dr-workflow-step {
    display: flex;
    min-height: 8.9rem;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    gap: 0.2rem;
    border-radius: var(--dr-radius-md);
    border: 1px solid var(--dr-border);
    background: rgba(255, 255, 255, 0.025);
    padding: 0.7rem 0.55rem;
    color: var(--dr-muted);
}

.dr-workflow-step:hover {
    transform: translateY(-1px);
    border-color: var(--dr-border-strong);
    background: var(--dr-surface-soft);
}

.dr-workflow-step--complete {
    border-color: rgba(74, 222, 128, 0.32);
    background: rgba(74, 222, 128, 0.08);
    color: #dcfce7;
}

.dr-workflow-step--active {
    border-color: rgb(var(--color-primary) / 0.55);
    background: rgb(var(--color-primary) / 0.09);
    box-shadow: 0 0 0 1px rgb(var(--color-primary) / 0.12);
    color: var(--dr-text);
}

.dr-workflow-step--warning {
    border-color: rgba(251, 191, 36, 0.42);
    background: rgba(251, 191, 36, 0.08);
    color: #fef3c7;
}

.dr-workflow-step--blocked {
    color: rgba(255, 255, 255, 0.5);
}

.dr-workspace-focus {
    border-left: 4px solid rgb(var(--color-primary) / 0.48);
    background:
        linear-gradient(90deg, rgb(var(--color-primary) / 0.07), transparent 44%),
        var(--dr-surface);
}

.dr-workspace-focus--neutral {
    border-left-color: rgb(var(--color-primary) / 0.42);
}

.dr-workspace-metric {
    min-width: 0;
    border: 1px solid var(--dr-border);
    border-radius: var(--dr-radius-md);
    background: rgba(0, 0, 0, 0.2);
    padding: 0.72rem 0.78rem;
}

.dr-meta-strip {
    display: flex;
    flex-wrap: wrap;
    gap: 0.38rem;
    color: rgba(255, 255, 255, 0.55);
    font-size: 0.62rem;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

.dr-meta-strip > span {
    min-width: 0;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(0, 0, 0, 0.22);
    padding: 0.22rem 0.48rem;
}

.dr-kicker {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.28em;
    text-transform: uppercase;
    color: var(--dr-subtle);
}

.dr-kicker::before {
    content: '';
    display: inline-block;
    width: 22px;
    height: 1px;
    background: rgb(var(--color-primary) / 0.7);
}

.dr-subpanel--danger {
    border-color: rgba(248, 113, 113, 0.28);
    background: linear-gradient(180deg, rgba(248, 113, 113, 0.08), var(--dr-surface-soft));
}

.dr-subpanel--danger .dr-kicker::before {
    background: rgba(248, 113, 113, 0.9);
}

.dr-body {
    color: var(--dr-muted);
    line-height: 1.65;
}

.dr-divider {
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--dr-border), transparent);
}

.dr-status {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    padding: 0.55rem 0.9rem;
    border-radius: var(--dr-radius-sm);
    border: 1px solid var(--dr-border);
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    background: var(--dr-surface-soft);
    color: var(--dr-text);
}

.dr-status::before {
    content: '';
    width: 8px;
    height: 8px;
    border-radius: 999px;
    background: currentColor;
    box-shadow: 0 0 0 4px rgb(255 255 255 / 0.05);
}

.dr-status--success {
    border-color: rgba(74, 222, 128, 0.22);
    background: rgba(74, 222, 128, 0.12);
    color: #b9f8c7;
}

.dr-status--info {
    border-color: rgba(56, 189, 248, 0.22);
    background: rgba(56, 189, 248, 0.1);
    color: #b3ebff;
}

.dr-status--warning {
    border-color: rgba(251, 191, 36, 0.24);
    background: rgba(251, 191, 36, 0.12);
    color: #fde68a;
}

.dr-status--danger {
    border-color: rgba(248, 113, 113, 0.26);
    background: rgba(248, 113, 113, 0.12);
    color: #fecaca;
}

.dr-status--neutral {
    border-color: var(--dr-border);
    background: var(--dr-surface-soft);
    color: var(--dr-muted);
}

.dr-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.7rem;
    min-height: 46px;
    padding: 0.85rem 1.1rem;
    border-radius: var(--dr-radius-md);
    border: 1px solid transparent;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    transition: transform 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

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

.dr-button:active {
    transform: translateY(0) scale(0.985);
}

.dr-button--primary {
    background-color: rgb(var(--color-primary));
    background-image: linear-gradient(135deg, rgb(var(--color-primary)), rgb(var(--color-accent)));
    color: #050505 !important;
    box-shadow: 0 18px 40px rgb(var(--color-primary) / 0.2);
}

.dr-button--garage-add {
    min-height: 50px;
    border-color: rgb(var(--color-primary) / 0.52);
    background-color: #d4ff00;
    background-image:
        linear-gradient(180deg, rgba(255, 255, 255, 0.28), transparent 46%),
        linear-gradient(135deg, rgb(var(--color-primary)), rgb(var(--color-accent)));
    box-shadow:
        0 18px 42px rgb(var(--color-primary) / 0.26),
        0 0 0 1px rgb(var(--color-primary) / 0.18),
        inset 0 1px 0 rgba(255, 255, 255, 0.35);
}

.dr-button--garage-add:hover:not(:disabled) {
    border-color: rgb(var(--color-primary) / 0.82);
    background-image:
        linear-gradient(180deg, rgba(255, 255, 255, 0.36), transparent 48%),
        linear-gradient(135deg, rgb(var(--color-primary)), #f5ff80);
    box-shadow:
        0 22px 54px rgb(var(--color-primary) / 0.34),
        0 0 0 1px rgb(var(--color-primary) / 0.28),
        inset 0 1px 0 rgba(255, 255, 255, 0.42);
}

.dr-button--garage-add:focus-visible {
    outline: none;
    box-shadow:
        0 20px 48px rgb(var(--color-primary) / 0.3),
        0 0 0 4px rgb(var(--color-primary) / 0.22);
}

.dr-button--garage-add:disabled {
    border-color: var(--dr-border);
    background: var(--dr-surface-soft);
    color: var(--dr-muted) !important;
    box-shadow: none;
    transform: none;
}

.dr-button--fit-optimizer {
    min-height: 54px;
    border-color: rgba(212, 255, 0, 0.45);
    border-color: rgb(var(--color-primary) / 0.45);
    background-color: #d4ff00;
    background-image:
        linear-gradient(180deg, rgba(255, 255, 255, 0.22), transparent 42%),
        linear-gradient(135deg, rgb(var(--color-primary)), rgb(var(--color-accent)));
    color: #050505 !important;
    box-shadow:
        0 18px 42px rgba(212, 255, 0, 0.18),
        inset 0 1px 0 rgba(255, 255, 255, 0.28);
}

.dr-button--fit-optimizer i,
.dr-button--fit-optimizer span {
    color: inherit;
}

.dr-button--fit-optimizer:hover:not(:disabled) {
    border-color: #f5ff80;
    box-shadow:
        0 22px 52px rgba(212, 255, 0, 0.26),
        inset 0 1px 0 rgba(255, 255, 255, 0.32);
}

.dr-button--fit-optimizer:disabled {
    cursor: wait;
    opacity: 0.86;
    transform: none;
}

.dr-button--secondary {
    background: var(--dr-surface-soft);
    border-color: var(--dr-border);
    color: var(--dr-text);
}

.dr-button--required {
    border-color: rgba(248, 113, 113, 0.58) !important;
    box-shadow: 0 0 0 1px rgba(248, 113, 113, 0.12);
}

.dr-button--ghost {
    background: transparent;
    border-color: var(--dr-border);
    color: var(--dr-muted);
}

.dr-label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.55rem;
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: var(--dr-subtle);
}

.dr-input,
.dr-select,
.dr-textarea {
    width: 100%;
    min-height: 48px;
    padding: 0.9rem 1rem;
    border: 1px solid var(--dr-border);
    border-radius: var(--dr-radius-md);
    outline: none;
    background: var(--dr-input-bg);
    color: var(--dr-text);
    font-size: 0.95rem;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}

.dr-input:hover,
.dr-select:hover,
.dr-textarea:hover {
    border-color: rgb(var(--color-primary) / 0.22);
}

.dr-input:focus,
.dr-select:focus,
.dr-textarea:focus {
    border-color: rgb(var(--color-primary) / 0.45);
    box-shadow: 0 0 0 4px rgb(var(--color-primary) / 0.12);
}

.dr-input--mono {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-weight: 700;
}

.dr-select,
select.dr-input {
    -webkit-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%2396a0ad' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    background-size: 14px;
    padding-right: 2.85rem;
    color-scheme: dark;
}

html:not(.dark) .dr-select,
html:not(.dark) select.dr-input {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    color-scheme: light;
}

.dr-range {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 8px;
    border-radius: 999px;
    background: linear-gradient(90deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.16));
    outline: none;
}

.dr-range::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 999px;
    border: 2px solid #050505;
    background: rgb(var(--color-primary));
    box-shadow: 0 0 0 5px rgb(var(--color-primary) / 0.18);
    cursor: pointer;
}

.dr-range::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 999px;
    border: 2px solid #050505;
    background: rgb(var(--color-primary));
    box-shadow: 0 0 0 5px rgb(var(--color-primary) / 0.18);
    cursor: pointer;
}

.dr-progress {
    position: relative;
    height: 10px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.08);
    overflow: hidden;
}

.dr-progress__target {
    position: absolute;
    top: 1px;
    bottom: 1px;
    border-radius: 999px;
    background: rgb(var(--color-primary) / 0.16);
}

.dr-progress__marker {
    position: absolute;
    top: 50%;
    width: 16px;
    height: 16px;
    border-radius: 999px;
    border: 2px solid #050505;
    background: rgb(var(--color-primary));
    transform: translate(-50%, -50%);
    box-shadow: 0 0 0 5px rgb(var(--color-primary) / 0.14);
}

.dr-callout-list {
    display: grid;
    gap: 0.8rem;
    list-style: none;
    padding: 0;
    margin: 0;
}

.dr-callout-item {
    display: flex;
    align-items: flex-start;
    gap: 0.8rem;
    padding: 0.95rem 1rem;
    border-radius: var(--dr-radius-md);
    background: var(--dr-surface-soft);
    border: 1px solid var(--dr-border);
    color: var(--dr-text);
}

.dr-callout-item::before {
    content: '';
    flex-shrink: 0;
    width: 10px;
    height: 10px;
    margin-top: 0.35rem;
    border-radius: 999px;
    background: rgb(var(--color-primary));
    box-shadow: 0 0 0 5px rgb(var(--color-primary) / 0.12);
}

.dr-callout-item--danger {
    border-color: rgba(248, 113, 113, 0.3);
    background: rgba(127, 29, 29, 0.18);
}

.dr-callout-item--danger::before,
.dr-subpanel--danger .dr-callout-item::before {
    background: rgb(248, 113, 113);
    box-shadow: 0 0 0 5px rgba(248, 113, 113, 0.14);
}

.dr-support-text {
    color: var(--dr-muted);
    line-height: 1.65;
}

.dr-control-cluster {
    display: grid;
    gap: 1rem;
    padding: 1rem;
    border-radius: var(--dr-radius-lg);
    border: 1px solid var(--dr-border);
    background: var(--dr-surface-soft);
}

.dr-control-cluster--tight {
    gap: 0.75rem;
}

.dr-control-hint {
    font-size: 0.82rem;
    line-height: 1.55;
    color: var(--dr-muted);
}

.dr-section-block {
    display: grid;
    gap: 0.9rem;
}

.dr-interpretation {
    display: grid;
    gap: 0.9rem;
    padding: 1rem 1.1rem;
    border-radius: var(--dr-radius-lg);
    border: 1px solid var(--dr-border);
    background: linear-gradient(180deg, rgb(var(--color-primary) / 0.07), var(--dr-surface-soft));
}

.dr-interpretation--warning {
    background: linear-gradient(180deg, rgba(251, 191, 36, 0.1), var(--dr-surface-soft));
    border-color: rgba(251, 191, 36, 0.22);
}

.dr-interpretation--danger {
    background: linear-gradient(180deg, rgba(248, 113, 113, 0.12), var(--dr-surface-soft));
    border-color: rgba(248, 113, 113, 0.24);
}

.dr-interpretation__title {
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--dr-subtle);
}

.dr-value-pair {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding-bottom: 0.7rem;
    border-bottom: 1px solid var(--dr-border);
}

.dr-value-pair:last-child {
    padding-bottom: 0;
    border-bottom: 0;
}

.dr-value-pair__label {
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--dr-subtle);
}

.dr-value-pair__value {
    font-size: 1rem;
    font-weight: 700;
    color: var(--dr-text);
}

.dr-action-strip {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.dr-action-strip > * {
    flex: 1 1 9rem;
}

.dr-hero-card {
    padding: 1.15rem 1.25rem;
    border-radius: var(--dr-radius-lg);
    border: 1px solid var(--dr-border);
    background: linear-gradient(180deg, rgb(255 255 255 / 0.04), var(--dr-surface-soft));
}

.dr-inline-note {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    font-size: 0.76rem;
    line-height: 1.4;
    color: var(--dr-muted);
}

.dr-inline-note::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 999px;
    background: rgb(var(--color-primary));
    box-shadow: 0 0 0 4px rgb(var(--color-primary) / 0.12);
}

.dr-bike-media {
    position: relative;
    min-height: 240px;
    background:
        linear-gradient(180deg, rgba(0, 0, 0, 0.12), rgba(0, 0, 0, 0.5)),
        linear-gradient(135deg, rgba(255, 255, 255, 0.06), transparent 55%),
        #0f141b;
}

.dr-bike-media::after {
    content: '';
    position: absolute;
    inset: auto 0 0;
    height: 45%;
    background: linear-gradient(180deg, transparent, rgba(6, 8, 11, 0.95));
    pointer-events: none;
}

.dr-empty-state {
    padding: 2rem;
}

.dr-grid-note {
    display: grid;
    gap: 0.75rem;
}

.dr-grid-note .dr-subpanel {
    padding: 1rem;
}

.dr-context-strip {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 0.75rem;
}

.dr-context-chip {
    min-width: 0;
    padding: 0.85rem 1rem;
    border: 1px solid var(--dr-border);
    border-radius: var(--dr-radius-md);
    background:
        linear-gradient(90deg, rgb(var(--color-primary) / 0.08), transparent 58%),
        var(--dr-surface-soft);
}

.dr-context-chip__label,
.dr-result-stat__label {
    display: block;
    color: var(--dr-subtle);
    font-size: 0.62rem;
    font-weight: 800;
    letter-spacing: 0.18em;
    text-transform: uppercase;
}

.dr-context-chip__value {
    display: block;
    margin-top: 0.35rem;
    overflow: hidden;
    color: var(--dr-text);
    font-family: 'Space Grotesk', sans-serif;
    font-size: 1rem;
    font-weight: 700;
    text-overflow: ellipsis;
    text-transform: uppercase;
    white-space: nowrap;
}

.dr-context-chip__hint {
    display: block;
    margin-top: 0.2rem;
    color: var(--dr-muted);
    font-size: 0.78rem;
    line-height: 1.35;
}

.dr-result-band {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 0.75rem;
}

.dr-result-stat {
    position: relative;
    overflow: hidden;
    padding: 1rem;
    border: 1px solid var(--dr-border);
    border-radius: var(--dr-radius-md);
    background: rgba(0, 0, 0, 0.18);
}

.dr-result-stat::after {
    content: '';
    position: absolute;
    inset: auto 0 0;
    height: 2px;
    background: var(--dr-border);
}

.dr-result-stat--success::after {
    background: #4ade80;
}

.dr-result-stat--info::after {
    background: #38bdf8;
}

.dr-result-stat--warning::after {
    background: #fbbf24;
}

.dr-result-stat--danger::after {
    background: #f87171;
}

.dr-result-stat__value {
    display: flex;
    align-items: baseline;
    gap: 0.35rem;
    margin-top: 0.45rem;
    color: var(--dr-text);
    font-family: 'Space Grotesk', sans-serif;
    font-size: clamp(1.65rem, 3vw, 2.35rem);
    font-weight: 800;
    line-height: 1;
}

.dr-result-stat__meta {
    margin-top: 0.4rem;
    color: var(--dr-muted);
    font-size: 0.78rem;
    line-height: 1.4;
}

.dr-result-stat__delta {
    color: var(--dr-muted);
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.8rem;
    font-weight: 800;
}

.dr-result-stat--success .dr-result-stat__delta {
    color: #86efac;
}

.dr-result-stat--warning .dr-result-stat__delta {
    color: #fde68a;
}

.dr-result-stat--danger .dr-result-stat__delta {
    color: #fecaca;
}

.dr-priority-callout {
    display: flex;
    align-items: flex-start;
    gap: 0.85rem;
    padding: 1rem;
    border: 1px solid rgb(var(--color-primary) / 0.22);
    border-radius: var(--dr-radius-md);
    background:
        linear-gradient(90deg, rgb(var(--color-primary) / 0.12), transparent 70%),
        var(--dr-surface-soft);
}

.dr-priority-callout__icon {
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    border-radius: var(--dr-radius-sm);
    background: rgb(var(--color-primary));
    color: #050505;
}

.dr-scan-list {
    display: grid;
    gap: 0.65rem;
}

.dr-scan-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.8rem 0;
    border-bottom: 1px solid var(--dr-border);
}

.dr-scan-item:last-child {
    border-bottom: 0;
}

.dr-scan-item__label {
    color: var(--dr-subtle);
    font-size: 0.68rem;
    font-weight: 800;
    letter-spacing: 0.16em;
    text-transform: uppercase;
}

.dr-scan-item__value {
    color: var(--dr-text);
    font-family: 'Space Grotesk', sans-serif;
    font-size: 1.15rem;
    font-weight: 800;
    text-align: right;
}

html,
body {
    min-height: 100%;
}

body {
    background: var(--dr-bg);
    color: var(--dr-text);
}

.dr-app-surface {
    position: fixed;
    inset: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background:
        linear-gradient(115deg, rgb(var(--color-primary) / 0.08), transparent 28%),
        var(--dr-bg);
}

.dr-surface-frame {
    width: min(100%, 96rem);
    margin: 0 auto;
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    padding: 1rem 1rem 1.5rem;
}

.dr-surface-body {
    flex: 1;
    min-height: 0;
    overflow: auto;
    overscroll-behavior: contain;
}

.dr-scroll-region {
    min-height: 0;
    overflow-y: auto;
    overflow-anchor: none;
    overscroll-behavior: contain;
    scrollbar-gutter: stable both-edges;
    -webkit-overflow-scrolling: touch;
}

.dr-scroll-region--soft {
    padding-right: 0.35rem;
}

.dr-sticky-bar {
    position: sticky;
    top: 0;
    z-index: 20;
    background: linear-gradient(180deg, rgb(6 8 11 / 0.95), rgb(6 8 11 / 0.72), transparent);
    backdrop-filter: blur(14px);
}

html:not(.dark) .dr-sticky-bar {
    background: linear-gradient(180deg, rgb(243 244 246 / 0.98), rgb(243 244 246 / 0.82), transparent);
}

.dr-dialog {
    position: relative;
    width: 100%;
    max-height: min(90svh, 56rem);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid var(--dr-border);
    border-radius: var(--dr-radius-xl);
    background:
        linear-gradient(115deg, rgb(var(--color-primary) / 0.08), transparent 30%),
        var(--dr-surface-strong);
    box-shadow: var(--dr-shadow);
}

.dr-dialog--wide {
    max-width: 72rem;
}

.dr-dialog--medium {
    max-width: 56rem;
}

.dr-dialog--narrow {
    max-width: 34rem;
}

.dr-dialog__header {
    flex-shrink: 0;
    padding: 1.5rem 1.5rem 1rem;
    border-bottom: 1px solid var(--dr-border);
    background: linear-gradient(180deg, rgb(255 255 255 / 0.03), transparent);
}

.dr-dialog__body {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 1.25rem 1.5rem 1.5rem;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
}

.dr-dialog__footer {
    flex-shrink: 0;
    padding: 1rem 1.5rem 1.5rem;
    border-top: 1px solid var(--dr-border);
    background: linear-gradient(0deg, rgb(255 255 255 / 0.02), transparent);
}

.dr-dropdown-panel {
    max-height: min(18rem, 40vh);
    overflow-x: hidden !important;
    overflow-y: auto !important;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-y;
}

.dr-tool-page {
    min-height: 100svh;
    background: var(--dr-bg);
    color: var(--dr-text);
}

.dr-tool-main {
    position: relative;
    z-index: 10;
    width: min(100%, 80rem);
    margin: 0 auto;
    padding: 8rem 1rem 4.5rem;
}

.dr-tool-hero {
    text-align: center;
    margin-bottom: 2.75rem;
}

.card-dark {
    background:
        linear-gradient(180deg, rgb(255 255 255 / 0.04), transparent 28%),
        var(--dr-surface-strong);
    border: 1px solid var(--dr-border);
    border-radius: var(--dr-radius-lg);
    box-shadow: var(--dr-shadow);
}

.label-dark {
    color: var(--dr-muted);
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.input-dark {
    width: 100%;
    min-height: 48px;
    padding: 0.9rem 1rem;
    border-radius: var(--dr-radius-md);
    border: 1px solid var(--dr-border);
    background: var(--dr-input-bg);
    color: var(--dr-text);
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}

.input-dark:focus {
    border-color: rgb(var(--color-primary) / 0.42);
    box-shadow: 0 0 0 4px rgb(var(--color-primary) / 0.12);
    outline: none;
}

.btn-primary,
.btn-secondary,
.nav-link {
    transition: transform 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.btn-primary:hover,
.btn-secondary:hover,
.nav-link:hover {
    transform: translateY(-1px);
}

.btn-primary {
    min-height: 48px;
    border-radius: var(--dr-radius-md);
    background: linear-gradient(135deg, rgb(var(--color-primary)), rgb(var(--color-accent)));
    color: #050505;
    border: 1px solid transparent;
    box-shadow: 0 18px 40px rgb(var(--color-primary) / 0.2);
}

.btn-secondary {
    min-height: 44px;
    border-radius: var(--dr-radius-md);
    border: 1px solid var(--dr-border);
    background: var(--dr-surface-soft);
    color: var(--dr-text);
}

.nav-link {
    border-radius: var(--dr-radius-md);
    border: 1px solid transparent;
}

.results {
    scroll-margin-top: 7rem;
}

.modal-overlay {
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
}

.modal-content {
    max-height: min(90svh, 48rem);
    overflow-y: auto;
}

html:not(.dark) .card-dark {
    background: var(--dr-surface-strong);
}

html:not(.dark) .btn-primary {
    color: #111827;
}

html:not(.dark) .input-dark {
    color: #111827;
}

html:not(.dark) .btn-secondary,
html:not(.dark) .nav-link {
    color: #111827;
}

/* Mobile Navigation Drawer Styles */
.mobile-nav-drawer {
    transform: translateX(100%);
    transition: transform 0.3s ease-in-out;
}

.mobile-nav-drawer.open {
    transform: translateX(0);
}

.mobile-nav-backdrop {
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s;
}

.mobile-nav-backdrop.open {
    opacity: 1;
    visibility: visible;
}

/* Mobile-specific touch improvements */
@media (max-width: 768px) {

    /* Increase touch target sizes */
    button,
    a,
    input,
    select,
    textarea {
        min-height: 44px;
    }

    /* Improve input visibility */
    input[type="text"],
    input[type="number"],
    input[type="email"],
    input[type="password"],
    input[type="date"],
    select,
    textarea {
        font-size: 16px !important;
        /* Prevents iOS zoom on focus */
    }

    /* Stack grids on mobile */
    .grid-cols-2:not(.no-stack),
    .grid-cols-3:not(.no-stack),
    .grid-cols-4:not(.no-stack) {
        grid-template-columns: 1fr !important;
    }

    /* Fix modal container widths */
    .fixed.inset-0>.dr-mobile-fullbleed {
        max-width: 100% !important;
        margin: 0 !important;
        border-radius: 0 !important;
    }

    .dr-dropdown-panel {
        position: static !important;
        width: 100% !important;
        max-height: min(16rem, 38svh);
        margin-top: 0.5rem !important;
        overscroll-behavior: contain;
    }

    /* Hero section adjustments */
    .text-5xl {
        font-size: 2rem !important;
    }

    .text-7xl {
        font-size: 2.5rem !important;
    }

    /* Reduce padding on mobile */
    .px-16 {
        padding-left: 1rem !important;
        padding-right: 1rem !important;
    }

    .px-12 {
        padding-left: 0.75rem !important;
        padding-right: 0.75rem !important;
    }

    .py-24 {
        padding-top: 3rem !important;
        padding-bottom: 3rem !important;
    }

    .py-12 {
        padding-top: 1.5rem !important;
        padding-bottom: 1.5rem !important;
    }

    /* Improve modal scrolling on mobile */
    .overflow-y-auto {
        -webkit-overflow-scrolling: touch;
    }

    /* Full-width cards on mobile */
    .min-w-\[350px\],
    .min-w-\[450px\] {
        min-width: 280px !important;
        width: calc(100vw - 2rem) !important;
    }

    /* Bike card height adjustment for mobile */
    .h-\[500px\] {
        height: 420px !important;
    }

    /* Modal content adjustments */
    .max-w-4xl,
    .max-w-5xl,
    .max-w-6xl,
    .max-w-7xl {
        max-width: 100% !important;
        padding-left: 0.5rem !important;
        padding-right: 0.5rem !important;
    }

    /* Onboarding modal mobile fix */
    .h-\[600px\] {
        height: auto !important;
        max-height: 90vh !important;
    }

    /* Hide sidebar on onboarding for mobile */
    .w-1\/3.hidden.md\:flex {
        display: none !important;
    }

    /* Top header bar adjustments */
    .absolute.top-0.w-full.p-8 {
        padding: 0.75rem !important;
    }

    /* Gap reductions */
    .gap-8 {
        gap: 1rem !important;
    }

    .gap-6 {
        gap: 0.75rem !important;
    }

    /* Adjust Fit Lab dashboard grid */
    .grid.lg\:grid-cols-2 {
        grid-template-columns: 1fr !important;
    }

    /* Text size adjustments for mobile readability */
    .text-6xl {
        font-size: 2rem !important;
    }

    .text-4xl {
        font-size: 1.5rem !important;
    }

    .text-3xl {
        font-size: 1.25rem !important;
    }

    .text-2xl {
        font-size: 1.125rem !important;
    }

    /* Improve form sections stacking */
    .flex-1.flex.flex-col {
        min-height: 0;
    }

    .dr-surface-frame {
        width: 100%;
        padding: 0.75rem;
    }

    .dr-dialog {
        max-height: min(100svh - 1.5rem, 56rem);
        border-radius: var(--dr-radius-xl);
    }

    .dr-dialog__header,
    .dr-dialog__body,
    .dr-dialog__footer {
        padding-left: 1rem;
        padding-right: 1rem;
    }

    .dr-tool-main {
        padding-top: 7rem;
        padding-bottom: 3rem;
    }

    /* Better spacing for stacked layouts */
    .space-y-6>*+* {
        margin-top: 1rem !important;
    }

    /* Clinic and other modal content adjustments */
    .max-w-6xl.mx-auto.px-6 {
        padding-left: 1rem !important;
        padding-right: 1rem !important;
    }

    /* Proving Grounds grid fix */
    .grid-cols-3 {
        grid-template-columns: 1fr !important;
    }

    /* Full-width buttons on mobile */
    .flex.gap-4>button,
    .flex.items-center.gap-6>button {
        flex: 1;
        justify-content: center;
    }

    /* Scrolling wrapper improvements */
    .scrolling-wrapper {
        padding-left: 1rem;
        padding-right: 1rem;
        scroll-padding-left: 1rem;
    }

    /* Card snap adjustments */
    .card-snap {
        scroll-snap-align: center;
    }

    /* Right controls (profile) - simplify on mobile */
    .flex.items-center.gap-3.bg-white\/90 {
        padding: 0.5rem !important;
    }

    /* Hide profile name text on small screens */
    .flex.flex-col.items-end>span.text-sm {
        display: none;
    }

    /* Modal close button improvements */
    .ph-x {
        font-size: 1.5rem !important;
    }
}

/* Tablet-specific adjustments (768px - 1024px) */
@media (min-width: 768px) and (max-width: 1024px) {

    /* Keep 2-col grids but adjust spacing */
    .grid-cols-2 {
        gap: 1rem !important;
    }

    /* Modal width adjustments */
    .max-w-6xl,
    .max-w-7xl {
        max-width: 95% !important;
    }

    /* Reduce padding slightly */
    .px-16 {
        padding-left: 2rem !important;
        padding-right: 2rem !important;
    }

    /* Card sizes for tablet */
    .min-w-\[450px\] {
        min-width: 340px !important;
    }

    /* Better text sizes for tablet */
    .text-7xl {
        font-size: 3.5rem !important;
    }

    .text-5xl {
        font-size: 2.5rem !important;
    }
}

/* Small mobile (under 375px - iPhone SE, etc) */
@media (max-width: 375px) {

    .text-5xl,
    .text-4xl {
        font-size: 1.5rem !important;
    }

    .text-3xl {
        font-size: 1.125rem !important;
    }

    .px-8 {
        padding-left: 0.5rem !important;
        padding-right: 0.5rem !important;
    }

    /* Smaller card width */
    .min-w-\[350px\],
    .min-w-\[280px\] {
        min-width: 260px !important;
    }

    /* Even smaller bike cards */
    .h-\[500px\],
    .h-\[420px\] {
        height: 360px !important;
    }

    /* Reduce font sizes further */
    .text-\[10px\] {
        font-size: 9px !important;
    }

    .text-xs {
        font-size: 10px !important;
    }
}

/* Landscape mobile adjustments */
@media (max-width: 896px) and (orientation: landscape) {

    /* Reduce hero height in landscape */
    .h-screen {
        height: auto !important;
        min-height: 100vh;
    }

    /* Adjust modal heights */
    .h-\[600px\] {
        height: 80vh !important;
    }

    /* Keep grids 2-col in landscape where it makes sense */
    .grid-cols-2.gap-6:not(.no-stack) {
        grid-template-columns: repeat(2, 1fr) !important;
    }
}

/* Touch device improvements */
@media (hover: none) and (pointer: coarse) {

    /* Remove hover-dependent UI */
    .group-hover\:opacity-100 {
        opacity: 1 !important;
    }

    /* Show customise button always on touch */
    .animate-pulse-subtle {
        animation: none !important;
    }

    /* Increase tap targets */
    .px-4.py-2.rounded-full {
        padding: 0.75rem 1rem !important;
    }

    /* Better scrollbar for touch */
    ::-webkit-scrollbar {
        height: 6px;
        width: 6px;
    }
}

/* Safe area adjustments for notched devices */
@supports(padding: max(0px)) {

    .fixed.bottom-0,
    .absolute.bottom-0 {
        padding-bottom: max(1rem, env(safe-area-inset-bottom));
    }

    .fixed.top-0,
    .absolute.top-0 {
        padding-top: max(0.5rem, env(safe-area-inset-top));
    }
}

/* Fix for iOS Safari viewport height issue */
@supports (-webkit-touch-callout: none) {
    .h-screen {
        height: -webkit-fill-available;
    }

    .min-h-screen {
        min-height: -webkit-fill-available;
    }
}

/* BioAudit Phase 7: studio/tablet/mobile resilience */
.dr-client-title {
    max-width: 100%;
    line-height: 0.95;
    overflow-wrap: anywhere;
    hyphens: auto;
}

.dr-tab-strip,
.dr-record-actions {
    min-width: 0;
}

.dr-tab-strip > .dr-button,
.dr-record-actions > .dr-button {
    flex: 0 0 auto;
}

.dr-ride-evidence-column {
    order: 1;
}

.dr-ride-entry-column {
    order: 2;
}

.dr-ride-profile-panel {
    order: 3;
}

@media (min-width: 1280px) {
    .dr-ride-evidence-column {
        grid-column: 1;
    }

    .dr-ride-entry-column {
        grid-column: 2;
    }
}

.dr-list-title {
    min-width: 0;
    max-width: 100%;
    overflow-wrap: anywhere;
    word-break: normal;
    line-height: 1.25;
}

.dr-record-row {
    min-width: 0;
}

.dr-chart-frame {
    position: relative;
    width: 100%;
    min-width: 0;
    min-height: 15rem;
    height: clamp(15rem, 32vw, 22rem);
    overflow: hidden;
    border: 1px solid var(--dr-border);
    border-radius: var(--dr-radius-md);
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.035), rgba(255, 255, 255, 0.01)),
        rgba(0, 0, 0, 0.32);
    padding: 0.75rem;
}

html.bioaudit-theme .dr-chart-frame {
    background:
        linear-gradient(180deg, rgba(246, 241, 232, 0.035), transparent 46%),
        rgba(7, 8, 7, 0.84);
}

html.bioaudit-theme:not(.dark) .dr-chart-frame {
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.82), rgba(255, 250, 240, 0.72)),
        #fffaf1;
    box-shadow:
        inset 0 0 0 1px rgba(75, 58, 33, 0.04),
        0 10px 24px rgba(62, 45, 24, 0.07);
}

.dr-chart-frame--compact {
    min-height: 13rem;
    height: clamp(13rem, 28vw, 18rem);
}

.dr-chart-frame--large {
    min-height: 18rem;
    height: clamp(18rem, 34vw, 24rem);
}

.dr-chart-frame > canvas {
    display: block;
    width: 100% !important;
    height: 100% !important;
}

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

.dr-studio-metric-grid {
    grid-template-columns: repeat(auto-fit, minmax(8.5rem, 1fr)) !important;
}

.dr-icon-control-grid {
    grid-template-columns: repeat(auto-fit, minmax(3rem, 1fr)) !important;
}

.dr-toggle-grid {
    grid-template-columns: repeat(auto-fit, minmax(8rem, 1fr)) !important;
}

@media (min-width: 640px) {
    .dr-workflow-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    }
}

@media (min-width: 1024px) {
    .dr-workflow-grid {
        grid-template-columns: repeat(6, minmax(0, 1fr)) !important;
    }
}

@media (max-width: 820px) {
    .dr-workspace-main {
        order: 1;
    }

    .dr-client-sidebar {
        order: 2;
    }

    .dr-workspace-tabs {
        display: grid !important;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        overflow: visible !important;
        padding-bottom: 0;
    }

    .dr-workspace-tabs > .dr-button {
        min-width: 0 !important;
        width: 100%;
        justify-content: center;
        padding-inline: 0.75rem;
    }

    .dr-workspace-tabs > .dr-button:first-child {
        grid-column: 1 / -1;
    }

    .dr-tab-strip {
        display: flex;
        flex-wrap: nowrap !important;
        max-width: 100%;
        overflow-x: auto;
        padding-bottom: 0.2rem;
        scroll-padding-inline: 0.75rem;
        touch-action: pan-x;
        -webkit-overflow-scrolling: touch;
    }

    .dr-tab-strip > .dr-button {
        min-width: max-content;
    }

    .dr-workflow-step {
        min-height: 7.75rem;
    }
}

@media (max-width: 640px) {
    .dr-client-title {
        font-size: clamp(1.75rem, 11vw, 2.65rem) !important;
        line-height: 0.98;
    }

    .dr-chart-frame,
    .dr-chart-frame--large,
    .dr-chart-frame--compact {
        min-height: 14rem;
        height: 58vw;
        max-height: 19rem;
        padding: 0.55rem;
    }

    .dr-record-row {
        align-items: stretch !important;
        flex-direction: column;
    }

    .dr-record-actions {
        width: 100%;
        justify-content: flex-end;
    }

    .dr-record-actions > .dr-button {
        min-width: 3.15rem;
    }

    .dr-toast {
        right: 0.75rem !important;
        left: 0.75rem !important;
        bottom: max(0.75rem, env(safe-area-inset-bottom)) !important;
        max-width: none !important;
    }
}

@media print {
    .dr-app-surface {
        position: static;
        overflow: visible;
    }

    .dr-surface-body {
        overflow: visible;
    }

    .dr-tab-strip,
    .dr-toast,
    .dr-button {
        print-color-adjust: exact;
        -webkit-print-color-adjust: exact;
    }
}
