:root {
    /* --- CORPORATE CLEAN 3-COLOR SYSTEM --- */
    --bg-primary: #0f172a;
    --text-primary: #f8fafc;
    --accent-primary: #3b82f6;

    --primary-gradient: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    --primary-hue: 217;
    /* Blue */
    --primary: #3b82f6;
    /* Trust Blue */
    --primary-dark: #2563eb;
    --secondary: #38bdf8;
    /* Soft Cyan */
    --bg-dark: #0f172a;
    /* Slate Black */
    --glass-bg: #1e293b;
    /* Solid Crisp Card background */
    --glass-border: rgba(255, 255, 255, 0.1);
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --success: #10b981;
    /* Muted Emerald */
    --danger: #ef4444;
    /* Brick Red */
    --warning: #f59e0b;
    /* Golden Amber */
    --info: #3b82f6;
    /* Muted Blue */
    --font-family: 'Inter', sans-serif;
    --radius: 12px;
    /* slightly crisper radius */
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    /* subtle drop shadow */
    --header-bg: #0f172a;
    --header-border: rgba(255, 255, 255, 0.1);
    --header-text: #f8fafc;
    --pill-bg: rgba(255, 255, 255, 0.05);
    --pill-border: rgba(255, 255, 255, 0.1);
    --profile-card-bg: #1e293b;
    --card-inner-bg: #0f172a;
    --slider-track: rgba(255, 255, 255, 0.2);
    --accent-blue: #38bdf8;
    --accent-blue-rgb: 56, 189, 248;

    /* Results & Premium Summary Variables */
    --res-label: #94a3b8;
    /* muted text */
    --res-value: #f8fafc;
    /* main text */
    --res-sub-label: #94a3b8;
    --res-border: rgba(255, 255, 255, 0.1);
    --res-payout-bg: rgba(0, 0, 0, 0.2);
    --bg-glass: #1e293b;

    /* Semantic Alert Variables */
    --alert-danger-bg: rgba(239, 68, 68, 0.1);
    --alert-danger-border: rgba(239, 68, 68, 0.3);
    --alert-danger-text: #fca5a5;

    --alert-info-bg: rgba(59, 130, 246, 0.1);
    --alert-info-border: rgba(59, 130, 246, 0.3);
    --alert-info-text: #93c5fd;
}

body.light-mode {
    --bg-primary: #f8fafc !important;
    --text-primary: #1e293b !important;
    --accent-primary: #1d4ed8 !important;

    --bg-dark: #f8fafc !important;
    --glass-bg: #ffffff !important;
    --glass-border: rgba(0, 0, 0, 0.1) !important;
    --text-main: #0f172a !important;
    --text-muted: #475569 !important;
    --primary: #1d4ed8 !important;
    --secondary: #2563eb !important;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06) !important;
    --header-bg: #ffffff !important;
    --header-border: rgba(0, 0, 0, 0.1) !important;
    --header-text: #0f172a !important;
    --pill-bg: rgba(0, 0, 0, 0.05) !important;
    --pill-border: rgba(0, 0, 0, 0.1) !important;
    --profile-card-bg: #f1f5f9 !important;
    --card-inner-bg: #ffffff !important;
    --slider-track: rgba(0, 0, 0, 0.15) !important;

    /* Light Mode Results Overrides */
    --res-label: #475569 !important;
    --res-value: #0f172a !important;
    --res-sub-label: #64748b !important;
    --res-border: rgba(0, 0, 0, 0.1) !important;
    --res-payout-bg: #f1f5f9 !important;
    --bg-glass: #ffffff !important;

    /* Semantic Alert Overrides */
    --alert-danger-bg: #fef2f2 !important;
    --alert-danger-border: #fca5a5 !important;
    --alert-danger-text: #b91c1c !important;

    --alert-info-bg: #eff6ff !important;
    --alert-info-border: #93c5fd !important;
    --alert-info-text: #1d4ed8 !important;

    --accent-blue: #2563eb !important;
    --accent-blue-rgb: 37, 99, 235 !important;
}

body.light-mode input[type="text"],
body.light-mode input[type="tel"],
body.light-mode input[type="password"],
body.light-mode input[type="number"],
body.light-mode input[type="date"],
body.light-mode input[type="time"],
body.light-mode input[type="datetime-local"],
body.light-mode select {
    background: rgba(255, 255, 255, 0.8) !important;
    color: #1f2937 !important;
    border: 1px solid rgba(0, 0, 0, 0.2) !important;
    color-scheme: light !important;
}

body.light-mode select option {
    background: #f8fafc !important;
    color: #1f2937 !important;
}

body.light-mode .upload-box {
    background: rgba(255, 255, 255, 0.5) !important;
    border: 2px dashed rgba(0, 0, 0, 0.2) !important;
}

body.light-mode .upload-text {
    color: #1f2937 !important;
}

body.light-mode header h1 {
    background: none !important;
    -webkit-text-fill-color: initial !important;
    color: var(--header-text) !important;
}

body.light-mode .glass-panel {
    background: #ffffff !important;
    border: 1px solid rgba(0, 0, 0, 0.1) !important;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06) !important;
    transition: all 0.3s ease;
}

body.light-mode .glass-panel:hover {
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05) !important;
    transform: translateY(-2px);
    border-color: var(--primary) !important;
}

body.light-mode .addon-row {
    background: rgba(0, 0, 0, 0.02) !important;
    border: 1px solid rgba(0, 0, 0, 0.04) !important;
    transition: all 0.2s ease;
}

body.light-mode .addon-row:hover {
    background: rgba(0, 0, 0, 0.08) !important;
    border-color: rgba(0, 0, 0, 0.15) !important;
}

body.light-mode .input-container {
    background: rgba(0, 0, 0, 0.02) !important;
    border: 1px solid rgba(0, 0, 0, 0.18) !important;
    transition: all 0.3s ease;
}

body.light-mode .input-container:hover {
    background: rgba(0, 0, 0, 0.08) !important;
    border-color: rgba(0, 0, 0, 0.15) !important;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.08) !important;
    transform: translateY(-2px);
}




/* Global Themed Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    border: 2px solid transparent;
    background-clip: content-box;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
    background-clip: content-box;
}

/* Light Mode Scrollbar Overrides */
body.light-mode ::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.05);
}

body.light-mode ::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.15);
}

body.light-mode ::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.25);
}

body.light-mode * {
    scrollbar-color: rgba(0, 0, 0, 0.2) rgba(0, 0, 0, 0.05);
}

/* Claims Modal Specific Scrollbar */
#claim-modal .modal-body::-webkit-scrollbar-thumb,
#claim-form-container::-webkit-scrollbar-thumb {
    background: rgba(255, 118, 117, 0.3);
    background-clip: content-box;
}

#claim-modal .modal-body::-webkit-scrollbar-thumb:hover,
#claim-form-container::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 118, 117, 0.5);
    background-clip: content-box;
}

/* Firefox */
* {
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.1) rgba(0, 0, 0, 0.2);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: var(--font-family);
}

.hidden {
    display: none !important;
}

body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    min-height: 100vh;
    overflow-x: hidden;
    width: 100%;
    position: relative;
    padding: 0.5rem 1rem;
    /* Compact padding */
    display: flex;
    justify-content: center;
}

/* Background Blobs */
.background-blobs {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    overflow: hidden;
}

.blob {
    position: absolute;
    filter: blur(80px);
    border-radius: 50%;
    opacity: 0.15;
    /* Reduced from 0.4 to avoid foggy look */
    animation: float 20s infinite alternate;
}

/* Modal Placeholder Styling - Attention Grabbing */
.modal input::placeholder,
.modal select::placeholder {
    color: rgba(255, 100, 100, 0.6) !important;
    opacity: 1;
    /* Firefox */
}

.modal input:focus::placeholder {
    color: rgba(255, 100, 100, 0.3) !important;
}

.modal input:focus::placeholder {
    color: rgba(255, 100, 100, 0.3) !important;
}

.blob-1 {
    width: 450px;
    height: 450px;
    background: radial-gradient(circle, var(--primary) 0%, transparent 70%);
    top: -150px;
    left: -100px;
}

.blob-2 {
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, var(--secondary) 0%, transparent 70%);
    bottom: -100px;
    right: -50px;
    animation-delay: -5s;
}

.blob-3 {
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, var(--primary-dark) 0%, transparent 70%);
    top: 40%;
    left: 40%;
    animation-delay: -10s;
}

@keyframes float {
    0% {
        transform: translate(0, 0) rotate(0deg);
    }

    100% {
        transform: translate(30px, 50px) rotate(10deg);
    }
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

@keyframes marquee {
    0% {
        transform: translateX(0);
    }

    100% {
        transform: translateX(-50%);
    }
}

/* Claims Module Theme */
#module-claims .calculate-btn {
    background: linear-gradient(135deg, #d46c6c 0%, #d63031 100%) !important;
}

#module-claims h2 {
    color: #d46c6c;
}

#claim-modal .modal-content {
    border-top: 5px solid #d46c6c;
}

.container {
    max-width: 1200px;
    width: 100%;
    z-index: 1;
}

/* Claims Modal Enhancements */
#claim-modal .modal-content {
    max-width: 1200px !important;
    /* Wider on Desktop */
    width: 95%;
    background: rgba(15, 23, 42, 0.98);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 118, 117, 0.2);
}

#claim-modal .input-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)) !important;
    /* Responsive Grid */
    gap: 25px !important;
}

#claim-modal .input-group input,
#claim-modal .input-group select,
#claim-modal .input-group textarea {
    background: rgba(0, 0, 0, 0.4) !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    padding: 4px 6px !important;
    font-size: 0.95rem !important;
    color: #ffffff !important;
    /* Force white text */
    transition: all 0.3s ease;
}

#claim-modal .input-group input:focus,
#claim-modal .input-group select:focus,
#claim-modal .input-group textarea:focus {
    border-color: #d46c6c !important;
    background: rgba(255, 118, 117, 0.05) !important;
    outline: none;
    box-shadow: 0 0 10px rgba(255, 118, 117, 0.1);
}

/* Explicitly fix date/time inputs which often have browser-default white backgrounds */
#claim-modal input[type="date"],
#claim-modal input[type="time"] {
    background: rgba(0, 0, 0, 0.4) !important;
    color-scheme: dark;
    /* Force browser calendar/clock to dark if supported */
}

#claim-modal input[type="date"]::-webkit-calendar-picker-indicator,
#claim-modal input[type="time"]::-webkit-calendar-picker-indicator {
    opacity: 0.8;
    cursor: pointer;
}

#claim-form-container {
    padding: 30px !important;
    /* More space */
}

header {
    text-align: center;
    margin-bottom: 0.5rem;
}

header h1 {
    font-size: 1.5rem;
    background: linear-gradient(to right, #fff, #a5b4fc);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;
    margin-bottom: 0.5rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

@media (min-width: 600px) {
    header h1 {
        font-size: 2rem;
        white-space: normal;
    }
}

header p {
    color: var(--text-muted);
}

/* Enhanced Main Header Styles */
#main-header {
    background: var(--header-bg);
    backdrop-filter: blur(8px);
    border-bottom: 2px solid var(--header-border);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    width: 100%;
    color: var(--header-text);
}

.header-auth-btn {
    background: var(--primary);
    color: #fff !important;
    border: none;
    padding: 8px 20px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 600;
    transition: all 0.2s;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.header-auth-btn:hover {
    filter: brightness(1.1);
    transform: translateY(-1px);
}

body.light-mode .header-auth-btn {
    background: #1e293b;
    /* Dark slate for high contrast on white */
    color: #ffffff !important;
}

.header-pill-container {
    display: flex;
    gap: 6px;
    align-items: center;
    background: var(--pill-bg);
    padding: 4px 10px;
    border-radius: 20px;
    border: 1px solid var(--pill-border);
}

body.light-mode .header-pill-container {
    background: rgba(0, 0, 0, 0.05);
    border-color: rgba(0, 0, 0, 0.1);
}

.header-quick-link {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.1rem;
    padding: 2px;
    transition: transform 0.2s;
}

.header-quick-link:hover {
    transform: scale(1.2);
}

/* Personal Message Ticker Enhancements */
#personal-msg-ticker {
    color: #4ade80;
    font-size: 0.82rem;
    font-weight: 600;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
    text-shadow: 0 0 10px rgba(74, 222, 128, 0.2);
    background: rgba(74, 222, 128, 0.1);
    border: 1px solid rgba(74, 222, 128, 0.3);
    padding: 4px 14px;
    border-radius: 20px;
}

body.light-mode #personal-msg-ticker {
    background: #f0fdf4;
    border-color: #86efac;
    color: #166534;
    text-shadow: none;
}

.calculator-grid {
    display: grid;
    grid-template-columns: 1.2fr 0.8fr;
    gap: 1.5rem;
}

/* Claims Module Theme */
#module-claims .calculate-btn {
    background: linear-gradient(135deg, #d46c6c 0%, #d63031 100%) !important;
}

#module-claims h2 {
    color: #d46c6c;
}

#claim-modal .modal-content {
    border-top: 5px solid #d46c6c;
}

.container {
    max-width: 1200px;
    width: 100%;
    z-index: 1;
}

/* Claims Modal Enhancements */
#claim-modal .modal-content {
    max-width: 1200px !important;
    /* Wider on Desktop */
    width: 95%;
    background: rgba(15, 23, 42, 0.98);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 118, 117, 0.2);
}

#claim-modal .input-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)) !important;
    /* Responsive Grid */
    gap: 25px !important;
}

#claim-modal .input-group input,
#claim-modal .input-group select,
#claim-modal .input-group textarea {
    background: rgba(0, 0, 0, 0.4) !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    padding: 4px 6px !important;
    font-size: 0.95rem !important;
    color: #ffffff !important;
    /* Force white text */
    transition: all 0.3s ease;
}

#claim-modal .input-group input:focus,
#claim-modal .input-group select:focus,
#claim-modal .input-group textarea:focus {
    border-color: #d46c6c !important;
    background: rgba(255, 118, 117, 0.05) !important;
    outline: none;
    box-shadow: 0 0 10px rgba(255, 118, 117, 0.1);
}

/* Explicitly fix date/time inputs which often have browser-default white backgrounds */
#claim-modal input[type="date"],
#claim-modal input[type="time"] {
    background: rgba(0, 0, 0, 0.4) !important;
    color-scheme: dark;
    /* Force browser calendar/clock to dark if supported */
}

#claim-modal input[type="date"]::-webkit-calendar-picker-indicator,
#claim-modal input[type="time"]::-webkit-calendar-picker-indicator {
    opacity: 0.8;
    cursor: pointer;
}

#claim-form-container {
    padding: 30px !important;
    /* More space */
}

header {
    text-align: center;
    margin-bottom: 0.5rem;
}

header h1 {
    font-size: 1.5rem;
    background: linear-gradient(to right, #fff, #a5b4fc);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;
    margin-bottom: 0.5rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

@media (min-width: 600px) {
    header h1 {
        font-size: 2rem;
        white-space: normal;
    }
}

header p {
    color: var(--text-muted);
}

/* Enhanced Main Header Styles */
#main-header {
    background: var(--header-bg);
    backdrop-filter: blur(8px);
    border-bottom: 2px solid var(--header-border);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    width: 100%;
    color: var(--header-text);
}

.header-auth-btn {
    background: var(--primary);
    color: #fff !important;
    border: none;
    padding: 8px 20px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 600;
    transition: all 0.2s;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.header-auth-btn:hover {
    filter: brightness(1.1);
    transform: translateY(-1px);
}

body.light-mode .header-auth-btn {
    background: #1e293b;
    /* Dark slate for high contrast on white */
    color: #ffffff !important;
}

.header-pill-container {
    display: flex;
    gap: 6px;
    align-items: center;
    background: var(--pill-bg);
    padding: 4px 10px;
    border-radius: 20px;
    border: 1px solid var(--pill-border);
}

body.light-mode .header-pill-container {
    background: rgba(0, 0, 0, 0.05);
    border-color: rgba(0, 0, 0, 0.1);
}

.header-quick-link {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.1rem;
    padding: 2px;
    transition: transform 0.2s;
}

.header-quick-link:hover {
    transform: scale(1.2);
}

/* Personal Message Ticker Enhancements */
#personal-msg-ticker {
    color: #4ade80;
    font-size: 0.82rem;
    font-weight: 600;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
    text-shadow: 0 0 10px rgba(74, 222, 128, 0.2);
    background: rgba(74, 222, 128, 0.1);
    border: 1px solid rgba(74, 222, 128, 0.3);
    padding: 4px 14px;
    border-radius: 20px;
}

body.light-mode #personal-msg-ticker {
    background: #f0fdf4;
    border-color: #86efac;
    color: #166534;
    text-shadow: none;
}

.calculator-grid {
    display: grid;
    grid-template-columns: 1.2fr 0.8fr;
    gap: 1.5rem;
    /* Reduced gap */
    align-items: stretch;
    /* vital for sticky sidebar to travel full height */
}

.grid-2-col {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
}

.left-column {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    /* Consistent gap between upload and input sections */
}

/* Add-ons Grid (Private Car) */
.addons-grid {
    display: grid;
    /* Controlled by toggleSection and inline display */
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 15px;
    margin-top: 15px;
    animation: fadeIn 0.3s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-5px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.addon-row {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    padding: 15px;
    transition: all 0.2s;
}

.addon-row:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.1);
}

/* Sidebar Submenu */
.sidebar-menu .submenu {
    list-style: none;
    padding-left: 1.5rem;
    margin-top: 0.5rem;
    position: relative;
}

.sidebar-menu .submenu li a {
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.7);
    padding: 0.5rem 0;
    display: block;
    transition: color 0.2s;
}

.sidebar-menu .submenu li a:hover {
    color: #fff;
    padding-left: 5px;
    /* Subtle movement */
}

/* Make Result Section Sticky */
.result-section {
    position: sticky;
    top: 2rem;
    height: fit-content;
}

@media (max-width: 900px) {
    .calculator-grid {
        grid-template-columns: 1fr;
    }

    .result-section {
        position: static;
    }
}

.glass-panel {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    padding: 2rem;
    box-shadow: var(--shadow);
    will-change: transform;
    transform: translate3d(0, 0, 0);
}

h2 {
    font-size: 1.25rem;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid var(--glass-border);
    padding-bottom: 0.5rem;
    color: var(--primary);
}

/* Upload Section */
.upload-section {
    margin-bottom: 2rem;
    border: 1px solid rgba(0, 255, 157, 0.2);
    /* Subtle green tint to highlight feature */
}

.upload-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1rem;
}

.upload-box {
    background: rgba(0, 0, 0, 0.2);
    border: 2px dashed var(--glass-border);
    border-radius: 12px;
    padding: 1.5rem 1rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.upload-box:hover {
    border-color: var(--primary);
    background: rgba(255, 255, 255, 0.05);
}

.upload-box.drag-over {
    border-color: var(--success);
    background: rgba(0, 255, 157, 0.1);
}

.upload-icon {
    font-size: 2rem;
    display: block;
    margin-bottom: 0.5rem;
}

.upload-text {
    font-weight: 500;
    font-size: 0.9rem;
    color: #fff;
    margin-bottom: 0.2rem;
}

.upload-box small {
    color: var(--text-muted);
    font-size: 0.75rem;
}

/* Scanning Animation */
.scan-line {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: var(--success);
    box-shadow: 0 0 10px var(--success);
    animation: scan 1.5s linear infinite;
    z-index: 10;
}

@keyframes scan {
    0% {
        top: 0%;
        opacity: 0;
    }

    10% {
        opacity: 1;
    }

    90% {
        opacity: 1;
    }

    100% {
        top: 100%;
        opacity: 0;
    }
}

/* Form Elements */
.form-group {
    margin-bottom: 1.5rem;
}

label {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
    color: var(--text-muted);
}

/* Segment Control */
.segment-control {
    display: flex;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 8px;
    padding: 4px;
    margin-bottom: 1rem;
}

.segment-control input[type="radio"] {
    display: none;
}

.segment-control label {
    flex: 1;
    text-align: center;
    padding: 8px 12px;
    margin: 0;
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.3s ease;
    color: var(--text-muted);
}

.segment-control input:checked+label {
    background: var(--primary);
    color: #fff;
    font-weight: 500;
}

/* Select and Inputs */
select,
input[type="number"] {
    width: 100%;
    padding: 12px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    color: #fff;
    font-size: 1rem;
    transition: 0.3s;
}

/* Include other text inputs */
input[type="text"],
input[type="tel"],
input[type="email"],
input[type="password"] {
    width: 100%;
    padding: 12px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    color: #fff;
    font-size: 1rem;
    transition: 0.3s;
}

/* Generic form group styling */
.input-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.input-group label {
    color: #cbd5e1;
    font-size: 0.9rem;
    margin-left: 4px;
}

.calculate-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    white-space: normal;
    /* Allow text wrapping on mobile */
    text-align: center;
    line-height: 1.2;
    gap: 6px;
    width: 100%;
    max-width: 100%;
    /* Prevent visual breakouts */
    padding: clamp(0.7rem, 3vw, 1rem);
    background: linear-gradient(90deg, var(--primary), var(--secondary));
    border: none;
    border-radius: var(--radius);
    color: white;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.calculate-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 20px rgba(167, 139, 250, 0.4);
}

select:focus,
input[type="number"]:focus {
    outline: none;
    border-color: var(--primary);
    background: rgba(0, 0, 0, 0.4);
}

select option {
    background: var(--bg-dark);
    color: #fff;
}

.input-with-icon {
    position: relative;
}

.currency-symbol {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
}

.input-with-icon input {
    padding-left: 30px;
}

/* Range Slider */
.input-with-slider {
    position: relative;
    display: flex;
    flex-wrap: wrap;
    /* Allows IDV (100% width) to wrap slider to next line, while Discount (small width) stays inline */
    align-items: center;
    gap: 0.5rem;
}

.input-with-slider .currency-symbol {
    position: absolute;
    left: 12px;
    top: 26px;
    /* Centered relative to the input field height (approx 52px) */
    transform: translateY(-50%);
    color: var(--text-muted);
    z-index: 2;
}

.range-wrapper {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

input[type=range] {
    -webkit-appearance: none;
    width: 100%;
    appearance: none;
    background: transparent;
    touch-action: pan-x;
    /* Fixes mobile drifting while sliding */
}

input[type=range]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    -moz-appearance: none;
    height: 20px;
    width: 20px;
    border-radius: 50%;
    background: var(--primary);
    cursor: pointer;
    margin-top: -8px;
    box-shadow: 0 0 10px var(--primary);
}

input[type=range]::-webkit-slider-runnable-track {
    width: 100%;
    height: 4px;
    cursor: pointer;
    background: var(--slider-track);
    border-radius: 2px;
}

input[type=range]::-moz-range-track {
    width: 100%;
    height: 4px;
    cursor: pointer;
    background: var(--slider-track);
    border-radius: 2px;
}

#age-display {
    font-weight: 600;
    color: var(--primary);
    text-align: right;
}

/* Checkbox */
.checkbox-group {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.checkbox-container {
    display: flex;
    align-items: center;
    position: relative;
    padding-left: 35px;
    cursor: pointer;
    user-select: none;
    color: var(--text-main);
    font-size: 0.95rem;
}

.checkbox-container input {
    position: absolute;
    opacity: 0;
    cursor: pointer;
    height: 0;
    width: 0;
}

.checkmark {
    position: absolute;
    top: 0;
    left: 0;
    height: 20px;
    width: 20px;
    background-color: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    transition: 0.2s;
}

.checkbox-container:hover input~.checkmark {
    background-color: rgba(255, 255, 255, 0.2);
}

.checkbox-container input:checked~.checkmark {
    background-color: var(--primary);
}

.checkmark:after {
    content: "";
    position: absolute;
    display: none;
}

.checkbox-container input:checked~.checkmark:after {
    display: block;
}

.checkbox-container .checkmark:after {
    left: 7px;
    top: 3px;
    width: 5px;
    height: 10px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.hint {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 4px;
    display: block;
    font-style: italic;
}

/* Disabled Restriction Styles */
.checkbox-container.disabled {
    opacity: 0.4;
    cursor: not-allowed;
    position: relative;
    /* Ensure validation msg is positioned relative to this */
}

/* NEW: Small Glass Button for Headers (SQMS etc) */
.glass-btn-sm {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    padding: 6px 16px;
    font-size: 0.85rem;
    color: #fff;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-weight: 500;
}

.glass-btn-sm:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-1px);
}

/* NEW: Header Quick Link Icons (Round) */
.header-quick-link {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    width: 32px;
    height: 32px;
    border-radius: 50%;
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    margin: 0;
}

.header-quick-link:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: scale(1.05);
    border-color: rgba(255, 255, 255, 0.4);
}


.checkbox-container.disabled input {
    pointer-events: none;
}

/* Enhanced Grey-out & Watermark for SATP */
.disabled-opacity {
    pointer-events: none !important;
    position: relative;
    cursor: not-allowed;
    transition: all 0.3s ease;
    overflow: hidden;
    /* Ensure overlay stays within card */
}

/* Semi-transparent overlay to fade the content but keep watermark opaque */
.disabled-opacity::after {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--bg-primary, #ffffff);
    opacity: 0.75;
    z-index: 50;
}

.disabled-opacity::before {
    content: "NOT APPLICABLE FOR TP ONLY";
    position: absolute;
    top: 50%;
    left: 50%;
    /* center it properly */
    transform: translate(-50%, -50%) rotate(-5deg);
    background: #dc2626;
    /* Strong red for high contrast in both modes */
    color: #ffffff;
    padding: 10px 24px;
    border: 3px solid #ffffff;
    border-radius: 8px;
    font-size: min(1.1rem, 4vw);
    font-weight: 900;
    z-index: 200;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.4);
    letter-spacing: 1px;
    white-space: nowrap;
    text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.6);
}

/* New: Subtle variant without watermark (for tight spaces like summary rows) */
.disabled-low-opacity {
    opacity: 0.35 !important;
    pointer-events: none !important;
    cursor: not-allowed !important;
    filter: grayscale(1) !important;
    position: relative;
    user-select: none;
}

/* Specific fix for inputs inside disabled sections */
.disabled-opacity input,
.disabled-opacity select,
.disabled-opacity button {
    cursor: not-allowed !important;
}

.checkbox-container.disabled:hover::after {
    content: attr(data-reason);
    position: absolute;
    right: 0;
    top: -25px;
    background: var(--danger);
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    white-space: nowrap;
    z-index: 10;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    animation: fadeIn 0.2s ease;
}

.checkbox-container.disabled:hover::before {
    /* Arrow for tooltip */
    content: "";
    position: absolute;
    right: 15px;
    top: -5px;
    border-width: 5px 5px 0;
    border-style: solid;
    border-color: var(--danger) transparent transparent transparent;
    z-index: 10;
    animation: fadeIn 0.2s ease;
}


/* Results */
.result-card {
    background: rgba(0, 0, 0, 0.15);
    border-radius: 12px;
    padding: 1rem;
    margin-bottom: 1rem;
}

.result-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.5rem;
    font-size: 0.95rem;
    color: var(--res-value);
}

.result-row.header {
    border-bottom: 1px dashed var(--res-border);
    padding-bottom: 0.5rem;
    margin-bottom: 0.8rem;
    font-weight: 600;
    color: var(--res-label);
}

.sub-item {
    font-size: 0.85rem;
    color: var(--res-sub-label);
    padding-left: 1rem;
}

.total-sub {
    border-top: 1px solid var(--res-border);
    margin-top: 0.5rem;
    padding-top: 0.5rem;
    font-weight: 600;
    color: var(--res-value);
}

.grand-total {
    margin-top: 2rem;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.1) 0%, rgba(255, 255, 255, 0.05) 100%);
    border: 1px solid var(--res-border);
}

.grand-total .result-row.final {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--success);
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.2);
}

.action-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
    gap: 6px;
    width: 100%;
    margin-top: 2rem;
    padding: 1rem;
    background: linear-gradient(90deg, var(--primary), var(--secondary));
    border: none;
    border-radius: var(--radius);
    color: white;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.action-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 20px rgba(167, 139, 250, 0.4);
}

.action-btn:active {
    transform: translateY(0);
}

/* Info Icon */
.info-icon {
    cursor: pointer;
    color: var(--primary);
    margin-left: 4px;
    font-size: 0.8rem;
    transition: opacity 0.2s;
}

.payout-header {
    font-weight: bold;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 1px;
    border-bottom: 1px solid var(--res-border);
    padding-bottom: 4px;
    color: var(--res-value);
}

.payout-header small {
    font-weight: normal;
    color: var(--res-label);
    text-transform: none;
}

.payout-section {
    margin-bottom: 8px;
    border-bottom: 1px solid var(--res-border);
    padding-bottom: 8px;
}

.payout-subheader {
    color: var(--secondary);
    font-size: 0.7rem;
    font-weight: bold;
    margin-bottom: 4px;
}

.payout-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 2px;
}

.payout-row small {
    color: var(--res-label);
}

.payout-footer {
    margin-top: 5px;
    color: var(--res-label);
}

.payout-total {
    display: flex;
    justify-content: space-between;
    font-weight: bold;
    font-size: 0.85rem;
    margin-bottom: 8px;
    color: var(--res-value);
}

.payout-section-incentives {
    margin-top: 8px;
    border-top: 1px solid var(--res-border);
    padding-top: 8px;
}

.payout-bonus {
    color: inherit;
    font-weight: bold;
}

display: inline-flex;
justify-content: center;
align-items: center;
width: 18px;
height: 18px;
border-radius: 50%;
background: rgba(59, 130, 246, 0.15);
color: #3b82f6;
font-size: 0.72rem;
font-style: italic;
font-weight: 800;
font-family: Georgia,
serif;
cursor: pointer;
margin-left: 6px;
transition: all 0.2s;
border: 1px solid rgba(59, 130, 246, 0.25);
vertical-align: middle;
line-height: 1;
flex-shrink: 0;
}

.info-icon:hover {
    background: #3b82f6;
    color: #0f172a;
    transform: scale(1.15);
    box-shadow: 0 0 8px rgba(59, 130, 246, 0.4);
}

/* Unread bell hover */
#unread-bell-container:hover {
    transform: scale(1.1);
    transition: transform 0.2s;
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    z-index: 2000;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 2rem;
    opacity: 1;
    transition: opacity 0.3s ease;
}

.modal.hidden {
    display: none !important;
}

.modal-content {
    background: linear-gradient(135deg, rgba(30, 41, 59, 0.95), rgba(15, 23, 42, 0.98));
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    max-width: 500px;
    width: 100%;
    position: relative;
    padding: 0;
    overflow: hidden;
    animation: slideUp 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes slideUp {
    from {
        transform: translateY(50px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-header {
    padding: 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    margin: 0;
    font-size: 1.3rem;
    border: none;
    padding: 0;
    color: #fff;
}

.close-modal {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 2rem;
    line-height: 1;
    cursor: pointer;
    transition: color 0.2s;
}

.close-modal:hover {
    color: #fff;
}

.modal-body {
    padding: 2rem;
    text-align: center;
}

.aligned-action-btn {
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 16px;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.2s ease;
    cursor: pointer;
    box-sizing: border-box;
    /* Crucial for height match */
}

.reset-btn-themed {
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 16px;
    border-radius: 8px;
    background: rgba(255, 107, 107, 0.15);
    border: 1px solid rgba(255, 107, 107, 0.4);
    color: #d65a5a;
    cursor: pointer;
    transition: all 0.2s;
    font-weight: 600;
    font-size: 0.9rem;
    letter-spacing: 0.5px;
    box-sizing: border-box;
}

.modal-icon-wrapper {
    font-size: 3rem;
    margin-bottom: 1.5rem;
    color: var(--primary);
}

.modal-body p {
    color: #cbd5e1;
    line-height: 1.6;
    margin-bottom: 2rem;
    text-align: left;
}

.read-more-btn {
    display: inline-block;
    padding: 0.8rem 1.5rem;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid var(--primary);
    border-radius: 8px;
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
    transition: all 0.2s;
}

.read-more-btn:hover {
    background: var(--primary);
    color: #fff;
}

/* Modal Refinements */
.modal-content {
    max-width: 600px !important;
    /* Larger width */
    padding: 2.5rem;
    background: linear-gradient(145deg, hsl(230, 30%, 12%), hsl(230, 30%, 8%));
    border: 1px solid rgba(255, 255, 255, 0.15);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
}

#agent-modal h2 {
    font-size: 1.8rem;
    background: linear-gradient(to right, #fff, #a5b4fc);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    border-bottom: 2px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 1rem;
    margin-bottom: 2rem;
}

#agent-modal label {
    font-size: 1.1rem;
    color: #e0e0e0;
    font-weight: 500;
}

#agent-modal input {
    width: 100%;
    padding: 1rem 1.2rem;
    margin-top: 0.5rem;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    color: #ffffff;
    font-size: 1.1rem;
    transition: all 0.3s ease;
}

#agent-modal input:focus {
    background: rgba(0, 0, 0, 0.5);
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.2);
    outline: none;
}

#agent-modal .warning-tag {
    background: rgba(255, 215, 0, 0.1);
    padding: 2px 8px;
    border-radius: 4px;
    border: 1px solid rgba(255, 215, 0, 0.3);
    animation: pulseWarning 2s infinite;
}

@keyframes pulseWarning {
    0% {
        opacity: 0.7;
    }

    50% {
        opacity: 1;
    }

    100% {
        opacity: 0.7;
    }
}

/* Modal Buttons */
#generate-pdf-btn {
    background: linear-gradient(90deg, #3aa7c9 0%, #7ad484 100%);
    color: #000;
    font-weight: 700;
    border: none;
    padding: 0.8rem 2rem;
    border-radius: 12px;
    cursor: pointer;
    transition: transform 0.2s;
}

#generate-pdf-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 255, 157, 0.3);
}

#cancel-pdf-btn {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #fff;
    padding: 0.8rem 1.5rem;
    border-radius: 12px;
    margin-right: 1rem;
    cursor: pointer;
}

#cancel-pdf-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* Secondary/Skip Button Style */
.secondary-btn {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: rgba(255, 255, 255, 0.8);
    font-weight: 600;
    padding: 0.8rem 1.5rem;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s;
}

.secondary-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    border-color: rgba(255, 255, 255, 0.6);
}

/* OCR Review Modal Specific Styles */
#ocr-review-modal .modal-content {
    background: rgba(20, 20, 35, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(20px);
    border-radius: 20px;
    padding: 2.5rem;
    max-width: 450px !important;
    /* Make it slimmer */
}

#ocr-review-modal .modal-header h2 {
    font-weight: 700;
    color: #fff;
    font-size: 1.5rem;
    text-align: center;
    width: 100%;
    margin-bottom: 0.5rem;
}

#ocr-review-modal .modal-body p {
    text-align: center;
    margin-bottom: 2rem;
}

#ocr-review-modal .input-group {
    margin-bottom: 1.2rem;
}

#ocr-review-modal .input-group label {
    color: #8f94a8;
    font-size: 0.8rem;
    font-weight: 600;
    margin-bottom: 6px;
    display: block;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

#ocr-review-modal input {
    width: 100%;
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.02));
    border: 1px solid rgba(255, 255, 255, 0.08);
    /* Subtle border */
    color: #fff;
    padding: 14px 16px;
    border-radius: 12px;
    font-size: 1rem;
    transition: all 0.3s ease;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.2);
}

#ocr-review-modal input:focus {
    background: rgba(255, 255, 255, 0.08);
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(100, 100, 255, 0.15), inset 0 2px 4px rgba(0, 0, 0, 0.1);
    outline: none;
}

#ocr-confirm-btn {
    background: linear-gradient(90deg, #4facfe 0%, #00f2fe 100%);
    color: #000;
    /* Dark text for contrast on bright gradient */
    font-weight: 800;
    border: none;
    border-radius: 14px;
    padding: 1.2rem;
    font-size: 1.1rem;
    letter-spacing: 0.5px;
    box-shadow: 0 10px 25px rgba(79, 172, 254, 0.3);
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    /* Full width button */
    margin-top: 1rem;
}

#ocr-confirm-btn:hover {
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 15px 35px rgba(79, 172, 254, 0.4);
}

#ocr-skip-btn {
    color: #aaa;
    border: none !important;
    background: transparent !important;
    font-size: 0.9rem;
    padding: 1rem;
    cursor: pointer;
    text-decoration: underline;
    opacity: 0.7;
    transition: opacity 0.2s;
    width: 100%;
    margin-top: 0.5rem;
}

#ocr-skip-btn:hover {
    opacity: 1;
    color: #fff;
}

/* Modal Actions Layout for OCR */
#ocr-review-modal .modal-actions {
    display: flex;
    flex-direction: column-reverse;
    /* Stack buttons, Skip at bottom */
    gap: 0.5rem;
}

/* Navigation Tabs (v3.0) */
/* Navigation Tabs (v3.0) - Themed */

/* Portfolio Tabs */
.portfolio-nav {
    display: flex;
    gap: 10px;
    margin-bottom: 2rem;
    padding-bottom: 15px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    overflow-x: auto;
    /* Glass container style just in case user wants it distinct */
    background: rgba(0, 0, 0, 0.2);
    padding: 10px;
    border-radius: 16px;
}

.nav-tab {
    background: rgba(255, 255, 255, 0.05);
    /* Slight glass bg */
    color: var(--text-muted);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 10px 25px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 500;
    transition: all 0.3s;
    border-radius: 30px;
    /* Pill shape */
    white-space: nowrap;
}

.nav-tab:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.15);
    transform: translateY(-2px);
    border-color: rgba(255, 255, 255, 0.3);
}

.nav-tab.active {
    color: #fff;
    font-weight: 700;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    /* Primary Gradient */
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    border: none;
    box-shadow: 0 4px 15px rgba(118, 75, 162, 0.4);
    opacity: 1;
}

/* CWISS RoundFix Tool Button (Distinct Badge Styling) */
.cwiss-tool-btn {
    margin-left: 6px;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 700;
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.2), rgba(217, 119, 6, 0.35));
    border: 1px solid rgba(245, 158, 11, 0.6);
    color: #fef08a;
    cursor: pointer;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    flex-shrink: 0;
    box-shadow: 0 2px 10px rgba(245, 158, 11, 0.25);
}

.cwiss-tool-btn:hover {
    transform: translateY(-2px);
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.35), rgba(217, 119, 6, 0.5));
    border-color: #f59e0b;
    box-shadow: 0 4px 15px rgba(245, 158, 11, 0.4);
    color: #ffffff;
}

body.light-mode .cwiss-tool-btn {
    background: linear-gradient(135deg, #fffbeb, #fef3c7);
    border: 1.5px solid #d97706;
    color: #92400e;
    box-shadow: 0 2px 8px rgba(217, 119, 6, 0.15);
}

body.light-mode .cwiss-tool-btn:hover {
    background: linear-gradient(135deg, #fef3c7, #fde68a);
    border-color: #b45309;
    color: #78350f;
    box-shadow: 0 4px 12px rgba(217, 119, 6, 0.3);
}

/* CWISS Trial & Error Interactive Highlight Animations */
@keyframes cwissAttentionPulse {
    0% {
        box-shadow: 0 0 0 0 rgba(59, 130, 246, 0.7);
        border-color: #3b82f6;
    }

    50% {
        box-shadow: 0 0 22px 5px rgba(59, 130, 246, 0.85);
        border-color: #60a5fa;
        transform: translateY(-1px);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(59, 130, 246, 0);
        border-color: #3b82f6;
        transform: translateY(0);
    }
}

.cwiss-editable-active {
    animation: cwissAttentionPulse 1.6s ease-in-out 3;
    border-color: #3b82f6 !important;
    background: rgba(59, 130, 246, 0.12) !important;
}

@keyframes cwissBadgeGlow {

    0%,
    100% {
        transform: scale(1);
        filter: drop-shadow(0 0 2px rgba(245, 158, 11, 0.4));
    }

    50% {
        transform: scale(1.06);
        filter: drop-shadow(0 0 8px rgba(245, 158, 11, 0.9));
    }
}

.cwiss-trial-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.25), rgba(217, 119, 6, 0.38));
    border: 1px solid #f59e0b;
    color: #fef08a;
    font-size: 0.68rem;
    font-weight: 800;
    padding: 3px 9px;
    border-radius: 12px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    animation: cwissBadgeGlow 2s infinite ease-in-out;
    box-shadow: 0 2px 6px rgba(245, 158, 11, 0.25);
}

/* Sub-Portfolio Navigation */
.sub-portfolio-nav {
    display: flex;
    gap: 12px;
    margin-bottom: 2rem;
    overflow-x: auto;
    padding: 5px 0 15px 0;
    /* Space for scrollbar/shadows */
}

.sub-tab {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: var(--text-muted);
    padding: 4px 16px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.3s;
    white-space: nowrap;
}

.sub-tab:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    border-color: #fff;
}

.sub-tab.active {
    background: #fff;
    color: var(--bg-dark);
    /* Dark text on white pill */
    font-weight: 700;
    border-color: #fff;
    opacity: 1;
    box-shadow: 0 4px 12px rgba(255, 255, 255, 0.2);
}

.sub-tab.disabled-sub-tab,
.sub-tab:disabled {
    opacity: 0.45 !important;
    cursor: not-allowed !important;
    pointer-events: none !important;
    border-color: rgba(255, 255, 255, 0.1) !important;
    color: var(--text-muted) !important;
    background: transparent !important;
}

/* Sidebar Styles */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: 250px;
    height: 100vh;
    background: rgba(15, 23, 42, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-right: 1px solid var(--glass-border);
    z-index: 10001;
    /* Above Loading Overlay */
    transform: translateX(-100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
}

.sidebar.active {
    transform: translateX(0);
}

.sidebar-header {
    padding: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--glass-border);
}

.sidebar-header h3 {
    margin: 0;
    background: linear-gradient(to right, #fff, var(--primary));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

#close-sidebar-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.8rem;
    cursor: pointer;
}

.sidebar-menu {
    list-style: none;
    padding: 1rem 0;
}

.sidebar-menu li {
    padding: 0 1rem;
    margin-bottom: 0.5rem;
}

.sidebar-menu a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 15px;
    color: var(--text-muted);
    text-decoration: none;
    border-radius: 12px;
    transition: all 0.2s;
    font-weight: 500;
}

.sidebar-menu a:hover,
.sidebar-menu li.active a {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    transform: translateX(5px);
}



/* Updated Sidebar Active State for consistency */
.sidebar-menu li.active a {
    background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    box-shadow: 0 4px 15px rgba(118, 75, 162, 0.4);
    font-weight: 600;
}

.sidebar-menu a:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    transform: translateX(4px);
}

.separator {
    height: 1px;
    background: var(--glass-border);
    margin: 1rem 0;
}

/* Other Calculator Tiles in Sidebar */
.sidebar-section-title {
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--primary);
    text-transform: uppercase;
    letter-spacing: 1.2px;
    margin: 0.8rem 1rem 0.6rem 1.2rem;
    opacity: 0.85;
    font-family: inherit;
}

.calc-tile-grid {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 0 0.8rem;
    margin-bottom: 0.8rem;
}

.calc-tile {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 15px;
    background: rgba(255, 255, 255, 0.05);
    /* Lighter background */
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    color: #fff;
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 600;
    /* Rigid letters */
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.calc-tile:hover {
    background: rgba(59, 130, 246, 0.15);
    /* More prominent on hover */
    border-color: rgba(59, 130, 246, 0.4);
    transform: translateX(5px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

.compact-grid .calc-tile {
    padding: 6px 12px;
    font-size: 0.82rem;
    margin-bottom: 5px;
}

.calc-tile span:first-child {
    font-size: 1.1rem;
}

/* Final Polish - Cursors & Interactions */
.sidebar-menu a {
    cursor: pointer;
}

#sidebar-toggle {
    cursor: pointer;
    transition: transform 0.2s;
}

#sidebar-toggle:hover {
    transform: scale(1.1);
}

#save-quote-btn {
    cursor: pointer;
}

#save-quote-btn:disabled {
    cursor: not-allowed;
    opacity: 0.7;
}

/* Grouping Container for Better Clarity */
.input-container {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 15px;
    transition: all 0.3s ease;
}

.input-container:hover {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.1);
}

.input-container label {
    display: block;
    margin-bottom: 8px;
    color: #e0e0e0;
    font-size: 0.9rem;
    font-weight: 500;
}

/* Individual Add-on Discount Container */
.addon-row {
    display: flex;
    flex-direction: column;
    margin-bottom: 10px;
    padding-bottom: 10px;
    border-bottom: 1px dashed rgba(255, 255, 255, 0.1);
}

.addon-row:last-child {
    border-bottom: none;
}

.addon-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.addon-discount-box {
    margin-top: 8px;
    padding-left: 28px;
    /* Align with text */
    display: none;
    /* Hidden by default until checked */
}

.addon-discount-box.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

.amount-words {
    display: block;
    font-size: 0.75rem;
    color: #3b82f6;
    font-style: italic;
    margin-top: 4px;
    opacity: 0.8;
}

/* (Legacy Toast Notifications superseded by Global Toast System below) */

.hidden-desktop {
    display: none !important;
}

.mobile-text {
    display: none !important;
}

/* --- MOBILE RESPONSIVENESS FIXES --- */
@media (max-width: 768px) {
    #profile-modal .modal-content {
        padding-bottom: 90px !important;
        margin-bottom: 70px !important;
    }

    #sqms-monitor-header-actions {
        flex-wrap: nowrap !important;
        gap: 6px !important;
        overflow-x: auto !important;
    }

    #sqms-monitor-header-actions .btn-text {
        display: none !important;
    }

    #sqms-monitor-header-actions button {
        padding: 6px 10px !important;
    }

    .mobile-text {
        display: inline-block !important;
    }

    .desktop-text {
        display: none !important;
    }

    .sqms-add-btn {
        position: fixed !important;
        bottom: 20px !important;
        right: 20px !important;
        width: 50px !important;
        height: 50px !important;
        border-radius: 25px !important;
        background: #007bff !important;
        color: white !important;
        box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3) !important;
        z-index: 9999 !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        font-size: 1.5rem !important;
    }

    .sqms-split-btn {
        position: fixed !important;
        bottom: 80px !important;
        right: 20px !important;
        width: 50px !important;
        height: 50px !important;
        border-radius: 25px !important;
        background: #10b981 !important;
        color: white !important;
        box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3) !important;
        z-index: 9999 !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        font-size: 1.2rem !important;
    }
}
}

/* Reset Button Theme (Shadowed by line 1030) */
/* Empty block removed */

.reset-btn-themed:hover {
    background: rgba(255, 107, 107, 0.25);
    border-color: #ff4757;
    box-shadow: 0 4px 15px rgba(255, 71, 87, 0.2);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(255, 107, 107, 0.2);
    color: #ff8787;
}

.reset-btn-themed:active {
    transform: translateY(0);
}

/* Tooltip implementation */
.tooltip {
    position: relative;
    cursor: pointer;
    margin-left: 5px;
    font-size: 0.9rem;
    color: var(--primary);
}

.tooltip::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 120%;
    left: 50%;
    transform: translateX(-50%);
    background-color: #333;
    color: #fff;
    padding: 5px 10px;
    border-radius: 4px;
    font-size: 0.75rem;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    z-index: 100;
}


/* File Input Theming */
input[type="file"] {
    background: rgba(255, 255, 255, 0.05);
    /* Transparent Dark */
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 8px;
    color: #ccc;
    font-size: 0.9rem;
    width: 100%;
    cursor: pointer;
}

input[type="file"]::file-selector-button {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: 4px;
    color: var(--text-muted);
    padding: 5px 10px;
    margin-right: 10px;
    cursor: pointer;
    transition: background 0.2s;
}

input[type="file"]::file-selector-button:hover {
    background: rgba(255, 255, 255, 0.2);
    color: white;
}

/* --- GEMINI AI ASSISTANT --- */

/* Floating Action Button (FAB) */
#gemini-assistant-fab {
    display: none !important;
    /* HIDE FAB */
    position: fixed;
    bottom: 90px;
    right: 20px;
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, #1e90ff, #00bfff);
    /* Gemini Blue-ish */
    border-radius: 50%;
    box-shadow: 0 4px 15px rgba(30, 144, 255, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 1000;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    animation: float 3s ease-in-out infinite;
}

#gemini-assistant-fab:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(30, 144, 255, 0.6);
}

#gemini-assistant-fab svg {
    width: 32px;
    height: 32px;
    fill: white;
}

@keyframes float {
    0% {
        transform: translateY(0px);
    }

    50% {
        transform: translateY(-5px);
    }

    100% {
        transform: translateY(0px);
    }
}

/* Chat Widget Container */
#gemini-chat-widget {
    position: fixed;
    bottom: 100px;
    right: 20px;
    width: 350px;
    height: 500px;
    background: rgba(20, 20, 30, 0.95);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    z-index: 999;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform-origin: bottom right;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

#gemini-chat-widget.hidden {
    display: none !important;
    /* Force hide */
}

/* Chat Header */
.chat-header {
    background: linear-gradient(90deg, #1e3799, #0c2461);
    padding: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.chat-header h3 {
    margin: 0;
    color: white;
    font-size: 1rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.close-chat-btn {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.7);
    font-size: 1.2rem;
    cursor: pointer;
    transition: color 0.2s;
}

.close-chat-btn:hover {
    color: white;
}

/* Chat Messages Area */
.chat-messages {
    flex: 1;
    padding: 15px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.2) transparent;
}

/* Scrollbar styling for Webkit */
.chat-messages::-webkit-scrollbar {
    width: 6px;
}

.chat-messages::-webkit-scrollbar-thumb {
    background-color: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
}

/* Message Bubbles */
.message {
    max-width: 80%;
    padding: 10px 14px;
    border-radius: 12px;
    font-size: 0.9rem;
    line-height: 1.4;
    word-wrap: break-word;
    animation: fadeIn 0.3s ease;
}

.message.user {
    align-self: flex-end;
    background: #0984e3;
    color: white;
    border-bottom-right-radius: 2px;
}

.message.ai {
    align-self: flex-start;
    background: rgba(255, 255, 255, 0.1);
    color: #dfe6e9;
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-bottom-left-radius: 2px;
}

.message.system {
    align-self: center;
    background: transparent;
    color: #636e72;
    font-size: 0.8rem;
    border: none;
    text-align: center;
}

/* Input Area */
.chat-input-area {
    padding: 12px;
    background: rgba(0, 0, 0, 0.3);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    gap: 10px;
}

.chat-attachment-btn {
    background: none;
    border: none;
    color: #a5b4fc;
    cursor: pointer;
    font-size: 1.2rem;
    padding: 5px;
    transition: color 0.2s;
}

.chat-attachment-btn:hover {
    color: #fff;
}

.chat-input {
    flex: 1;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    padding: 8px 15px;
    color: white;
    outline: none;
    font-size: 0.9rem;
}

.chat-input::placeholder {
    color: rgba(255, 255, 255, 0.4);
}

.chat-send-btn {
    background: #0984e3;
    border: none;
    border-radius: 50%;
    width: 35px;
    height: 35px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: white;
    transition: background 0.2s;
}

.chat-send-btn:hover {
    background: #00cec9;
}

/* Typing Indicator */
.typing-dots span {
    display: inline-block;
    width: 6px;
    height: 6px;
    background: #ccc;
    border-radius: 50%;
    margin-right: 3px;
    animation: typing 1s infinite;
}

.typing-dots span:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-dots span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typing {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-5px);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes rowBlink {
    0% {
        background: rgba(50, 255, 50, 0.22);
    }

    50% {
        background: rgba(50, 255, 50, 0.55);
    }

    100% {
        background: rgba(50, 255, 50, 0.22);
    }
}

.blinking-row {
    animation: rowBlink 1.5s 40 forwards !important;
    /* Stops after ~60s */
    background: rgba(50, 255, 50, 0.25) !important;
    border-left: 3px solid #22c55e !important;
}

.static-attended-row {
    background: rgba(34, 197, 94, 0.33) !important;
    /* Static Parrot Green (120% more opaque / clearly visible) */
    border-left: 3px solid rgba(34, 197, 94, 0.85) !important;
}

.self-active-row {
    background: rgba(59, 130, 246, 0.33) !important;
    /* Subtle Blue for Self (120% more opaque / clearly visible) */
    border-left: 3px solid #3b82f6 !important;
}

.sqms-row.static-attended-row,
.sqms-row.self-active-row,
.sqms-row.blinking-row {
    opacity: 0.96 !important;
}

.sqms-attendance-eye {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: default;
    user-select: none;
    line-height: 1;
}

.sqms-attendance-eye.active-attending {
    animation: eyePulse 1.5s ease-in-out infinite;
}

@keyframes eyePulse {

    0%,
    100% {
        transform: scale(1);
        filter: drop-shadow(0 0 2px rgba(50, 255, 50, 0.8));
    }

    50% {
        transform: scale(1.22);
        filter: drop-shadow(0 0 6px rgba(50, 255, 50, 1));
    }
}

/* Current Record Loaded in Right Details Pane (Unique to user, does not clash with background colors) */
.sqms-row-current-viewing>td {
    border-top: 2px solid rgba(56, 189, 248, 0.85) !important;
    border-bottom: 2px solid rgba(56, 189, 248, 0.85) !important;
}

.sqms-row-current-viewing>td:first-child {
    border-left: 5px solid #38bdf8 !important;
    box-shadow: inset 4px 0 8px -2px rgba(56, 189, 248, 0.5) !important;
}

.sqms-row-current-viewing>td:last-child {
    border-right: 3px solid rgba(56, 189, 248, 0.85) !important;
}

.sqms-active-pane-arrow {
    display: inline-block;
    color: #38bdf8;
    font-size: 0.72rem;
    line-height: 1;
    margin-right: 2px;
    filter: drop-shadow(0 0 4px #38bdf8);
    animation: sqmsArrowBounce 1.4s ease-in-out infinite alternate;
}

@keyframes sqmsArrowBounce {
    from {
        transform: translateX(0);
        opacity: 0.85;
    }

    to {
        transform: translateX(2px);
        opacity: 1;
        filter: drop-shadow(0 0 8px #38bdf8);
    }
}

/* Unopened Attachment Red Border Highlight (Table, Details Pane & Chat) */
.unopened-attachment {
    border: 2px solid #ef4444 !important;
    box-shadow: 0 0 9px rgba(239, 68, 68, 0.85), inset 0 0 4px rgba(239, 68, 68, 0.4) !important;
    position: relative !important;
    animation: unopenedPulse 2s ease-in-out infinite;
}

.sqms-audio-player-wrap.unopened-attachment {
    border-radius: 28px !important;
    padding: 2px !important;
    box-shadow: 0 0 10px rgba(239, 68, 68, 0.9) !important;
}

@keyframes unopenedPulse {

    0%,
    100% {
        box-shadow: 0 0 6px rgba(239, 68, 68, 0.7), inset 0 0 3px rgba(239, 68, 68, 0.3);
    }

    50% {
        box-shadow: 0 0 12px rgba(239, 68, 68, 0.95), inset 0 0 6px rgba(239, 68, 68, 0.5);
    }
}

.unopened-attachment-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: #ef4444;
    color: #ffffff;
    font-size: 8px;
    font-weight: 800;
    padding: 1px 3px;
    border-radius: 3px;
    box-shadow: 0 0 6px rgba(239, 68, 68, 0.9);
    line-height: 1;
    z-index: 10;
    pointer-events: none;
    letter-spacing: 0.5px;
}

/* --- SQMS TABLE STYLES --- */
.sqms-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
    color: #e2e8f0;
}

.sqms-table th,
.sqms-table td {
    padding: 2px 4px;
    line-height: 1.2;
    /* Super compact */
    text-align: left;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.sqms-table th:first-child,
.sqms-row td:first-child {
    width: 64px !important;
    min-width: 64px !important;
    max-width: 70px !important;
    padding: 2px 4px !important;
    text-align: center;
    overflow: visible !important;
}

.sqms-table th {
    white-space: nowrap;
    /* Force one line */
    font-size: 0.75rem;
    /* Smaller headers */
    text-transform: uppercase;
    letter-spacing: 0.5px;
    vertical-align: middle;
}

.sqms-table th:nth-child(2),
.sqms-table td:nth-child(2) {
    width: 50px;
    text-align: center;
}

.sqms-table th:nth-child(3),
.sqms-table td:nth-child(3) {
    width: 100px;
}

.sqms-table th:nth-child(4),
.sqms-table td:nth-child(4) {
    width: 130px;
}

.sqms-table th:nth-child(5),
.sqms-table td:nth-child(5) {
    width: 140px;
}

.sqms-table th:nth-child(6),
.sqms-table td:nth-child(6) {
    width: 160px;
    max-width: 160px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sqms-table th:nth-child(7),
.sqms-table td:nth-child(7) {
    width: 250px;
    max-width: 560px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sqms-table th:nth-child(8),
.sqms-table td:nth-child(8) {
    width: 250px;
    max-width: 560px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sqms-table th:nth-child(9),
.sqms-table td:nth-child(9) {
    width: 150px;
    font-size: 0.8rem;
}

.sqms-table th:nth-child(10),
.sqms-table td:nth-child(10) {
    width: 100px;
    text-align: center;
}

.sqms-table th {
    background: rgba(15, 23, 42, 0.95);
    position: sticky;
    top: 0;
    z-index: 10;
    font-weight: 600;
    color: #94a3b8;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.5px;
}

/* Group Headers */
.group-header td {
    font-weight: bold;
    color: #fff;
    padding: 3px 8px;
    /* Compact Group Header */
    background: rgba(255, 255, 255, 0.05);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    text-transform: uppercase;
    font-size: 0.8rem;
    letter-spacing: 1px;
}

.group-header.status-sip td {
    border-left: 5px solid #3b82f6;
    background: linear-gradient(90deg, rgba(59, 130, 246, 0.35), transparent);
}

.group-header.status-sip .status-badge {
    color: #60a5fa;
    font-weight: bold;
    background: rgba(59, 130, 246, 0.2);
}

.group-header.status-violet td {
    border-left: 5px solid #8b5cf6;
    background: linear-gradient(90deg, rgba(139, 92, 246, 0.35), transparent);
}

.group-header.status-violet .status-badge {
    color: #a78bfa;
    font-weight: bold;
    background: rgba(139, 92, 246, 0.2);
}

.group-header.status-shortfall td {
    border-left: 5px solid #ef4444;
    background: linear-gradient(90deg, rgba(239, 68, 68, 0.35), transparent);
}

.group-header.status-shortfall .status-badge {
    color: #f87171;
    font-weight: bold;
    background: rgba(239, 68, 68, 0.2);
}

.group-header.status-completed td {
    border-left: 5px solid #10b981;
    background: linear-gradient(90deg, rgba(16, 185, 129, 0.35), transparent);
}

.group-header.status-completed .status-badge {
    color: #34d399;
    font-weight: bold;
    background: rgba(16, 185, 129, 0.2);
}

.group-header.status-todo td {
    border-left: 5px solid #FF9933;
    background: linear-gradient(90deg, rgba(255, 153, 51, 0.35), transparent);
}

.group-header.status-todo .status-badge {
    color: #FF9933;
    font-weight: bold;
    background: rgba(255, 153, 51, 0.2);
}

@keyframes redBlink {
    0% {
        opacity: 1;
        box-shadow: 0 0 5px #ff4757;
    }

    50% {
        opacity: 0.3;
        box-shadow: 0 0 2px #ff4757;
    }

    100% {
        opacity: 1;
        box-shadow: 0 0 5px #ff4757;
    }
}

@keyframes dateExpiredPulse {
    0% {
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7);
        border-color: #ef4444 !important;
    }

    50% {
        box-shadow: 0 0 0 6px rgba(239, 68, 68, 0.35);
        border-color: #f87171 !important;
    }

    100% {
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0);
        border-color: #ef4444 !important;
    }
}

.date-expired-alert {
    border: 2px solid #ef4444 !important;
    animation: dateExpiredPulse 1.5s infinite !important;
}

.red-blink-dot {
    display: block;
    width: 8px;
    height: 8px;
    background: #ff4757;
    border-radius: 50%;
    box-shadow: 0 0 5px #ff4757;
    animation: redBlink 1s infinite ease-in-out;
}

.status-badge {
    background: rgba(255, 255, 255, 0.08);
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.9rem;
    /* Larger Font */
    font-weight: bold;
    /* Ensure Bold */
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.sqms-row.row-shortfall {
    background: rgba(239, 68, 68, 0.02);
}

.sqms-row.row-todo {
    background: rgba(255, 153, 51, 0.05);
    /* Faint Saffron */
    opacity: 0.75;
    /* Pale effect */
}

.sqms-row.row-completed {
    opacity: 0.7;
}

.sqms-row.row-completed td {
    font-size: 0.82rem !important;
}

.sqms-row.row-completed td small {
    font-size: 0.72rem !important;
}

.sqms-row.active-row {
    background: rgba(59, 130, 246, 0.1) !important;
    border-right: 3px solid #3b82f6;
}

.sqms-row:hover {
    background: rgba(255, 255, 255, 0.02);
    cursor: pointer;
}

/* Landscape / Tablet / PC Split View */
@media (min-width: 993px) {
    #sqms-side-pane.active {
        display: flex !important;
        animation: slideInRight 0.3s ease-out;
    }

    #sqms-main-content.split-view .table-responsive {
        flex: 1 1 60% !important;
    }
}

@keyframes slideInRight {
    from {
        transform: translateX(30px);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.icon-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.1rem;
    padding: 4px;
    opacity: 0.7;
    transition: opacity 0.2s;
    color: #ddd;
}

.icon-btn:hover {
    opacity: 1;
    transform: scale(1.1);
}

.edit-btn:hover {
    color: #facc15;
}

.delete-btn:hover {
    color: #d65a5a;
}

.stat-pill {
    background: rgba(255, 255, 255, 0.05);
    padding: 4px 10px;
    /* Reduced Padding */
    border-radius: 15px;
    /* Tighter radius */
    font-size: 0.8rem;
    /* Smaller Font */
    color: #aaa;
    white-space: nowrap;
    cursor: pointer;
    transition: all 0.2s;
    border: 1px solid transparent;
    user-select: none;
}

.stat-pill:hover,
.stat-pill.active {
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
    border-color: rgba(255, 255, 255, 0.2);
}

.count-badge {
    background: rgba(0, 0, 0, 0.4);
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.75rem;
    margin-left: 5px;
}

/* Responsive SQMS Tweaks */
.table-responsive {
    display: block;
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin-bottom: 1rem;
}

.sqms-detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 15px;
    margin-bottom: 1.5rem;
}

@media (max-width: 768px) {
    .sqms-detail-grid {
        grid-template-columns: 1fr !important;
    }

    .sqms-table th,
    .sqms-table td {
        padding: 4px 6px;
        line-height: 1.2;
        font-size: 0.8rem;
        white-space: nowrap;
        width: auto !important;
        max-width: none !important;
    }

    /* Ensure modal fits */
    #sqms-detail-modal {
        padding: 8px 6px !important;
        box-sizing: border-box !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
    }

    #sqms-detail-modal .modal-content {
        width: 96% !important;
        max-width: 580px !important;
        max-height: 92dvh !important;
        max-height: 92vh !important;
        height: auto !important;
        display: flex !important;
        flex-direction: column !important;
        overflow: hidden !important;
        margin: 0 auto !important;
        border-radius: 14px !important;
        position: relative !important;
    }
}

/* --- SQMS MOBILE DETAIL MODAL & BUTTONS LOCK FIX --- */
#sqms-detail-modal {
    padding: 8px 6px !important;
    box-sizing: border-box !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}

#sqms-detail-modal .modal-content {
    width: 96% !important;
    max-width: 580px !important;
    max-height: 92dvh !important;
    max-height: 92vh !important;
    height: auto !important;
    display: flex !important;
    flex-direction: column !important;
    overflow: hidden !important;
    margin: 0 auto !important;
    border-radius: 14px !important;
    position: relative !important;
}

#sqms-detail-modal .sqms-detail-view {
    display: flex !important;
    flex-direction: column !important;
    height: 100% !important;
    max-height: 100% !important;
    min-height: 0 !important;
    overflow: hidden !important;
}

#sqms-detail-modal .modal-header {
    flex-shrink: 0 !important;
    padding: 0.35rem 0.6rem !important;
}

#sqms-detail-modal .modal-body {
    flex: 1 1 auto !important;
    min-height: 0 !important;
    max-height: none !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch !important;
    overscroll-behavior: contain !important;
    padding: 0.6rem !important;
}

#sqms-detail-modal .modal-footer {
    flex-shrink: 0 !important;
    position: relative !important;
    bottom: auto !important;
    margin-top: auto !important;
    padding: 8px 12px calc(8px + env(safe-area-inset-bottom, 0px)) !important;
    width: 100% !important;
    box-sizing: border-box !important;
    background: #1e293b !important;
    border-top: 1px solid rgba(255, 255, 255, 0.12) !important;
    z-index: 100 !important;
    border-radius: 0 0 14px 14px !important;
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
}

.sqms-light-mode#sqms-detail-modal .modal-footer {
    background: #f1f5f9 !important;
    border-top: 1px solid rgba(0, 0, 0, 0.1) !important;
}

#sqms-detail-modal .modal-footer>div {
    display: flex !important;
    align-items: center !important;
}

#sqms-detail-modal .modal-footer button {
    min-height: 38px !important;
    height: auto !important;
    padding: 6px 14px !important;
    font-size: 0.8rem !important;
    font-weight: 700 !important;
    border-radius: 6px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    white-space: nowrap !important;
    flex: none !important;
}

/* --- SQMS CHAT & VIEWER PREFIX CONTROLS FIX (MOBILE VISIBILITY) --- */
#sqms-chat-pdf-prefix,
select#sqms-chat-pdf-prefix,
#viewer-doc-prefix,
select#viewer-doc-prefix {
    height: 26px !important;
    min-height: 26px !important;
    max-height: 26px !important;
    font-size: 0.78rem !important;
    line-height: 24px !important;
    padding: 0 6px !important;
    color: #38bdf8 !important;
    background-color: #0f172a !important;
    border: 1px solid rgba(56, 189, 248, 0.5) !important;
    border-radius: 4px !important;
    font-weight: 700 !important;
    box-sizing: border-box !important;
    cursor: pointer !important;
    -webkit-appearance: menulist !important;
    appearance: menulist !important;
    vertical-align: middle !important;
    display: inline-block !important;
}

#sqms-chat-pdf-prefix option,
select#sqms-chat-pdf-prefix option,
#viewer-doc-prefix option,
select#viewer-doc-prefix option {
    background-color: #0f172a !important;
    color: #38bdf8 !important;
    font-size: 0.82rem !important;
    padding: 4px !important;
}

#sqms-chat-pdf-prefix-custom,
input#sqms-chat-pdf-prefix-custom,
#viewer-doc-prefix-custom,
input#viewer-doc-prefix-custom {
    height: 26px !important;
    min-height: 26px !important;
    max-height: 26px !important;
    width: 38px !important;
    font-size: 0.78rem !important;
    line-height: 24px !important;
    padding: 0 4px !important;
    text-align: center !important;
    text-transform: uppercase !important;
    background-color: #1e293b !important;
    border: 1px solid #38bdf8 !important;
    border-radius: 4px !important;
    color: #38bdf8 !important;
    font-weight: 800 !important;
    box-sizing: border-box !important;
    vertical-align: middle !important;
    display: inline-block !important;
}

#sqms-chat-window input[type="range"]#sqms-chat-img-quality {
    padding: 0 !important;
    margin: 0 !important;
    height: 4px !important;
}

/* --- ULTRA COMPACT MOBILE OPTIMIZATION (Optimization for small screens) --- */
@media (max-width: 768px) {
    body {
        padding: 4px !important;
        /* Minimal body padding */
    }

    .container {
        padding: 0 !important;
        margin: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
    }

    /* Maximize Glass Panels (Main Content) */
    .glass-panel {
        padding: 8px !important;
        /* Reduced from 2rem */
        margin-bottom: 8px !important;
        border-radius: 8px !important;
        width: 100% !important;
        box-shadow: none !important;
        /* Save performance and space */
    }

    /* POPUPS: Maximize Screen Usage (96% Width) */
    .modal-content,
    .modal-content.glass-panel {
        width: 96% !important;
        max-width: 98% !important;
        margin: 10px auto !important;
        padding: 0 !important;
        /* Remove outer padding of modal card */
        left: 0 !important;
        right: 0 !important;
        border-radius: 12px !important;
    }

    /* Adjust Inner Modal Padding */
    .modal-body {
        padding: 8px !important;
        max-height: 85vh !important;
    }

    .modal-header {
        padding: 10px 12px !important;
    }

    .modal-footer,
    .form-actions {
        display: flex !important;
        flex-direction: row !important;
        justify-content: space-between !important;
        padding: 10px !important;
        gap: 10px !important;
        align-items: center !important;
    }

    .modal-footer button,
    .form-actions button {
        flex: 1 !important;
        justify-content: center !important;
        white-space: normal !important;
        margin: 0 !important;
        padding: 10px 5px !important;
        font-size: 0.85rem !important;
        text-align: center !important;
        height: auto !important;
        min-height: 44px;
    }

    /* Compact Headers */
    header {
        margin-bottom: 0.5rem !important;
        padding-top: 5px !important;
    }

    header h1 {
        font-size: 1.5rem !important;
        margin-bottom: 0.2rem !important;
    }

    h2 {
        font-size: 1.1rem !important;
        margin-bottom: 0.5rem !important;
        padding-bottom: 5px !important;
    }

    /* Compact Forms */
    .form-group {
        margin-bottom: 0.8rem !important;
    }

    label {
        margin-bottom: 2px !important;
        font-size: 0.85rem !important;
    }

    input,
    select,
    textarea {
        padding: 8px 10px !important;
        font-size: 16px !important;
        /* Prevent iOS Zoom */
    }

    /* Remove gaps in grids */
    .calculator-grid,
    .upload-grid,
    .left-column {
        gap: 8px !important;
    }

    /* SQMS Specifics */
    #module-sqms .glass-panel {
        padding: 5px !important;
        /* Very tight for table container */
    }
}

@keyframes bump-text {
    0% {
        transform: scale(1);
    }

    100% {
        transform: scale(1.05);
    }
}

.bump-anim {
    animation: bump-text 0.8s infinite alternate;
}

@keyframes bump-text-strong {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.15);
    }

    100% {
        transform: scale(1);
    }
}

.bump-anim-strong {
    animation: bump-text-strong 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275) infinite !important;
    text-shadow: 0 0 5px rgba(241, 196, 15, 0.5);
}


/* HAZARDOUS WARNING STYLES - Appended */
.hazardous-glow {
    box-shadow: inset 0 0 100px rgba(255, 0, 0, 0.3) !important;
    /* Reduced 50% */
    border: 3px solid rgba(255, 0, 0, 0.5) !important;
    /* Reduced opacity */
    animation: pulseRed 1s infinite alternate;
}

@keyframes pulseRed {
    from {
        box-shadow: inset 0 0 50px rgba(255, 0, 0, 0.2);
        border-color: rgba(255, 0, 0, 0.3);
    }

    to {
        box-shadow: inset 0 0 150px rgba(255, 0, 0, 0.4);
        border-color: rgba(255, 0, 0, 0.6);
    }
}

#hazardous-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: transparent;
    /* Fully transparent background */
    z-index: 99999;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    padding-top: 15vh;
    align-items: center;
    text-align: center;
    pointer-events: none;
    /* Removed backdrop-filter so user can see clearly */
}

.warning-box {
    background: rgba(20, 20, 30, 0.97);
    border: 2px solid rgba(255, 77, 77, 0.95);
    border-radius: 16px;
    padding: 30px 40px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.6);
    max-width: 90%;
    width: auto;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    opacity: 1;
    animation: popIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes popIn {
    from {
        transform: scale(0.8);
        opacity: 0;
    }

    to {
        transform: scale(1);
        opacity: 1;
    }
}

/* Mobile Fix for Date Fields - Strong Override */
@media (max-width: 768px) {

    /* Force stacking of date fields */
    #tw-delivery-date-wrapper>div,
    #car-delivery-date-wrapper>div,
    #cv-delivery-date-wrapper>div {
        display: flex !important;
        flex-direction: row !important;
        align-items: center !important;
        gap: 8px !important;
    }

    /* Container for each input */
    #tw-delivery-date-wrapper div>div,
    #car-delivery-date-wrapper div>div,
    #cv-delivery-date-wrapper div>div {
        width: auto !important;
        text-align: right !important;
    }

    /* Input styling */
    #tw-delivery-date-wrapper input[type="date"],
    #car-delivery-date-wrapper input[type="date"],
    #cv-delivery-date-wrapper input[type="date"],
    input[type="date"] {
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
        font-size: 0.9rem !important;
        /* Slightly smaller text */
        padding: 6px !important;
    }

    /* Ensure labels align right */
    #tw-delivery-date-wrapper label,
    #car-delivery-date-wrapper label,
    #cv-delivery-date-wrapper label {
        text-align: right !important;
        margin-bottom: 4px !important;
    }

    /* Profile Modal Mobile Fixes */
    #profile-modal .modal-content {
        width: 95% !important;
        max-width: 95% !important;
        margin: 10px auto !important;
        max-height: 90vh !important;
    }

    #profile-modal .modal-body,
    #profile-modal .modal-content>div:nth-child(2) {
        padding: 1rem !important;
    }

    #profile-modal div[style*="flex-end"] {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 10px !important;
    }

    #profile-modal #profile-photo-thumb,
    #profile-modal #profile-letterhead-thumb {
        width: 100% !important;
        height: 60px !important;
        border-radius: 8px !important;
    }

    #profile-modal #profile-photo-thumb img {
        height: 100% !important;
        width: auto !important;
        margin: 0 auto !important;
        display: block !important;
    }

    #profile-modal #profile-letterhead-thumb img {
        height: auto !important;
        width: 100% !important;
        object-fit: contain !important;
        margin: 0 auto !important;
        display: block !important;
    }

    #profile-modal .input-group label {
        font-size: 0.8rem !important;
    }

    #profile-modal input,
    #profile-modal select {
        padding: 10px !important;
        font-size: 0.9rem !important;
    }
}

/* Dark Mode Date & Time Inputs */
body:not(.light-mode) input[type="date"],
body:not(.light-mode) input[type="time"],
body:not(.light-mode) input[type="datetime-local"] {
    background: rgba(255, 255, 255, 0.08) !important;
    border: 1px solid rgba(255, 255, 255, 0.3) !important;
    border-radius: 6px !important;
    padding: 6px 12px !important;
    color: #ffffff !important;
    color-scheme: dark !important;
    transition: all 0.2s ease !important;
}

body:not(.light-mode) input[type="date"]:focus,
body:not(.light-mode) input[type="time"]:focus,
body:not(.light-mode) input[type="datetime-local"]:focus {
    background: rgba(255, 255, 255, 0.15) !important;
    border-color: var(--accent-blue) !important;
    box-shadow: 0 0 8px rgba(var(--accent-blue-rgb), 0.4) !important;
}

/* Light Mode Date & Time Inputs */
body.light-mode input[type="date"],
body.light-mode input[type="time"],
body.light-mode input[type="datetime-local"] {
    background: #ffffff !important;
    border: 1.5px solid #94a3b8 !important;
    border-radius: 6px !important;
    padding: 6px 12px !important;
    color: #0f172a !important;
    color-scheme: light !important;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05) !important;
    transition: all 0.2s ease !important;
}

body.light-mode input[type="date"]:focus,
body.light-mode input[type="time"]:focus,
body.light-mode input[type="datetime-local"]:focus {
    background: #ffffff !important;
    border-color: #2563eb !important;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.2) !important;
}

/* Calendar & Clock Picker Indicators - High Contrast in Both Modes */
body:not(.light-mode) input[type="date"]::-webkit-calendar-picker-indicator,
body:not(.light-mode) input[type="time"]::-webkit-calendar-picker-indicator,
body:not(.light-mode) input[type="datetime-local"]::-webkit-calendar-picker-indicator {
    cursor: pointer !important;
    opacity: 0.95 !important;
    width: 20px !important;
    height: 20px !important;
    filter: none !important;
    transition: transform 0.15s ease, opacity 0.15s ease;
}

body:not(.light-mode) input[type="date"]::-webkit-calendar-picker-indicator:hover,
body:not(.light-mode) input[type="time"]::-webkit-calendar-picker-indicator:hover,
body:not(.light-mode) input[type="datetime-local"]::-webkit-calendar-picker-indicator:hover {
    opacity: 1 !important;
    transform: scale(1.1);
}

body.light-mode input[type="date"]::-webkit-calendar-picker-indicator,
body.light-mode input[type="time"]::-webkit-calendar-picker-indicator,
body.light-mode input[type="datetime-local"]::-webkit-calendar-picker-indicator {
    cursor: pointer !important;
    opacity: 0.9 !important;
    width: 20px !important;
    height: 20px !important;
    filter: none !important;
    transition: transform 0.15s ease, opacity 0.15s ease;
}

body.light-mode input[type="date"]::-webkit-calendar-picker-indicator:hover,
body.light-mode input[type="time"]::-webkit-calendar-picker-indicator:hover,
body.light-mode input[type="datetime-local"]::-webkit-calendar-picker-indicator:hover {
    opacity: 1 !important;
    transform: scale(1.1);
}

/* Prevent calendar emoji from showing in the date value and ensure text is white */
input[type="date"]::-webkit-datetime-edit-text,
input[type="date"]::-webkit-datetime-edit-month-field,
input[type="date"]::-webkit-datetime-edit-day-field,
input[type="date"]::-webkit-datetime-edit-year-field,
input[type="time"]::-webkit-datetime-edit-text,
input[type="time"]::-webkit-datetime-edit-hour-field,
input[type="time"]::-webkit-datetime-edit-minute-field,
input[type="time"]::-webkit-datetime-edit-ampm-field,
input[type="datetime-local"]::-webkit-datetime-edit-text,
input[type="datetime-local"]::-webkit-datetime-edit-month-field,
input[type="datetime-local"]::-webkit-datetime-edit-day-field,
input[type="datetime-local"]::-webkit-datetime-edit-year-field,
input[type="datetime-local"]::-webkit-datetime-edit-hour-field,
input[type="datetime-local"]::-webkit-datetime-edit-minute-field,
input[type="datetime-local"]::-webkit-datetime-edit-ampm-field {
    color: #fff !important;
}

#hazardous-overlay h1 {
    font-size: 3rem;
    color: #ff4d4d;
    text-transform: uppercase;
    font-weight: 900;
    text-shadow: 0 0 20px red;
    margin-bottom: 2rem;
    animation: shake 0.5s cubic-bezier(.36, .07, .19, .97) both infinite;
}

#hazardous-overlay span.sub-warning {
    color: #ffcccc;
    font-size: 1.5rem;
    display: block;
    margin-top: 10px;
}

@keyframes shake {

    10%,
    90% {
        transform: translate3d(-1px, 0, 0);
    }

    20%,
    80% {
        transform: translate3d(2px, 0, 0);
    }

    30%,
    50%,
    70% {
        transform: translate3d(-4px, 0, 0);
    }

    40%,
    60% {
        transform: translate3d(4px, 0, 0);
    }
}

/* Mobile Fix: Drastically reduce Hazardous Warning Text Size */
@media (max-width: 600px) {
    #hazardous-overlay {
        padding-top: 10vh !important;
        /* Ensure it stays at top */
    }

    #hazardous-overlay h1 {
        font-size: 1.5rem !important;
        /* ~25-30% of desktop size */
        margin-bottom: 5px !important;
    }

    #hazardous-overlay .sub-warning {
        font-size: 0.9rem !important;
        /* Much smaller message */
        margin-top: 5px !important;
        width: 90%;
        /* Ensure it wraps if long */
    }

    #hazardous-overlay p {
        font-size: 0.75rem !important;
        /* Small guidance text */
        margin-top: 2px !important;
        padding: 4px 10px !important;
    }
}

/* Custom Scrollbar for SQMS */
.table-responsive::-webkit-scrollbar,
#sqms-side-pane::-webkit-scrollbar,
.modal-body::-webkit-scrollbar,
.custom-scrollbar::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

.table-responsive::-webkit-scrollbar-track,
#sqms-side-pane::-webkit-scrollbar-track,
.modal-body::-webkit-scrollbar-track,
white-space: normal !important;
overflow: visible !important;
line-height: 1.4;
word-break: break-word;
}

#sqms-resize-handle {
    background: rgba(255, 255, 255, 0.1);
    transition: background 0.2s;
}

#sqms-resize-handle:hover,
#sqms-resize-handle:active {
    background: #facc15;
}

/* --- GLOBAL TOAST SYSTEM (Bottom Left on Desktop, Top Center on Mobile) --- */
#toast-container {
    position: fixed !important;
    bottom: 24px !important;
    left: 24px !important;
    right: auto !important;
    top: auto !important;
    transform: none !important;
    z-index: 999999 !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 10px !important;
    pointer-events: none !important;
    max-width: min(440px, 90vw) !important;
    width: auto !important;
}

@media (max-width: 768px) {
    #toast-container {
        top: 16px !important;
        bottom: auto !important;
        left: 50% !important;
        right: auto !important;
        transform: translateX(-50%) !important;
        align-items: center !important;
        width: calc(100% - 32px) !important;
        max-width: 440px !important;
    }
}

.toast {
    pointer-events: auto;
    background: rgba(15, 23, 42, 0.95);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    color: #ffffff;
    padding: 10px 18px;
    border-radius: 10px;
    font-size: 0.88rem;
    font-weight: 600;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.15);
    display: inline-flex;
    align-items: center;
    gap: 10px;
    animation: toastSlideInLeft 0.3s cubic-bezier(0.18, 0.89, 0.32, 1.28);
    max-width: 100%;
    word-break: break-word;
    transition: opacity 0.35s ease, transform 0.35s ease;
}

@media (max-width: 768px) {
    .toast {
        animation: toastSlideDown 0.3s cubic-bezier(0.18, 0.89, 0.32, 1.28) !important;
        text-align: center;
        justify-content: center;
    }
}

.toast.success {
    background: linear-gradient(135deg, #059669 0%, #10b981 100%);
    border-color: #34d399;
    color: #ffffff;
    box-shadow: 0 6px 20px rgba(16, 185, 129, 0.4);
}

.toast.error {
    background: linear-gradient(135deg, #dc2626 0%, #ef4444 100%);
    border-color: #f87171;
    color: #ffffff;
    box-shadow: 0 6px 20px rgba(239, 68, 68, 0.4);
}

.toast.warning {
    background: linear-gradient(135deg, #d97706 0%, #f59e0b 100%);
    border-color: #fbbf24;
    color: #ffffff;
    box-shadow: 0 6px 20px rgba(245, 158, 11, 0.4);
}

.toast.info {
    background: linear-gradient(135deg, #0284c7 0%, #0ea5e9 100%);
    border-color: #38bdf8;
    color: #ffffff;
    box-shadow: 0 6px 20px rgba(14, 165, 233, 0.4);
}

@keyframes toastSlideInLeft {
    from {
        transform: translateX(-30px) scale(0.95);
        opacity: 0;
    }

    to {
        transform: translateX(0) scale(1);
        opacity: 1;
    }
}

@keyframes toastSlideDown {
    from {
        transform: translateY(-25px) scale(0.95);
        opacity: 0;
    }

    to {
        transform: translateY(0) scale(1);
        opacity: 1;
    }
}

.module-header {
    flex-wrap: wrap;
    /* Allow content to wrap on small screens */
    gap: 10px;
    /* Add spacing when wrapped */
    position: relative;
    z-index: 100;
    /* Prioritize header clicks */
}

/* Feedback Form Button Hover Effects */
#feedback-submit-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(16, 185, 129, 0.5);
}

#feedback-cancel-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.4);
}

/* â”€â”€ Cache Clear Blink â”€â”€ */
@keyframes cacheBlink {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.25;
    }
}

/* â”€â”€ Themed Scrollbars for About Modal â”€â”€ */
#about-modal .modal-body::-webkit-scrollbar,
#about-modal #feedback-list::-webkit-scrollbar {
    width: 6px;
}

#about-modal .modal-body::-webkit-scrollbar-track,
#about-modal #feedback-list::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.04);
    border-radius: 3px;
}

#about-modal .modal-body::-webkit-scrollbar-thumb,
#about-modal #feedback-list::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 3px;
}

#about-modal .modal-body::-webkit-scrollbar-thumb:hover,
#about-modal #feedback-list::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, #7b93ff 0%, #9060c7 100%);
}

/* Firefox */
#about-modal .modal-body,
#about-modal #feedback-list {
    scrollbar-width: thin;
    scrollbar-color: #764ba2 rgba(255, 255, 255, 0.04);
}

/* â”€â”€ Feedback Cluster Expand/Collapse â”€â”€ */
.fb-cluster-toggle {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: #94a3b8;
    font-size: 0.7rem;
    padding: 3px 10px;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s;
    margin-top: 6px;
    user-select: none;
}

.fb-cluster-toggle:hover {
    background: rgba(255, 255, 255, 0.12);
    color: #e2e8f0;
    border-color: rgba(255, 255, 255, 0.25);
}

.fb-cluster-body {
    overflow: hidden;
    transition: max-height 0.35s ease;
}

.fb-cluster-body.collapsed {
    max-height: 120px !important;
}

/* â”€â”€ Mobile: Cache message visible â”€â”€ */
@media (max-width: 768px) {
    .cache-clear-blink {
        font-size: 0.5rem !important;
        padding: 2px 5px !important;
    }
}

/* â”€â”€ Themed Sidebar Scrollbar â”€â”€ */
.sidebar {
    overflow-y: auto;
}

.sidebar::-webkit-scrollbar {
    width: 5px;
}

.sidebar::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.03);
}

.sidebar::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 3px;
}

.sidebar::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, #7b93ff 0%, #9060c7 100%);
}

/* Firefox */
.sidebar {
    scrollbar-width: thin;
    scrollbar-color: #764ba2 rgba(255, 255, 255, 0.03);
}

/* About Modal Responsiveness */
.about-modal-content {
    max-width: 1050px !important;
}

@media (min-width: 1024px) {
    .about-modal-content {
        max-width: 1575px !important;
        /* 1.5x wider (150% of present size) */
    }
}

#feedback-signin-msg:hover {
    background: rgba(255, 255, 255, 0.08) !important;
    border-color: rgba(255, 255, 255, 0.3) !important;
    transform: scale(1.02);
}

/* â”€â”€ Mobile & Small Screens Optimization â”€â”€ */
@media screen and (max-width: 768px) {
    body {
        padding: 0.4rem;
    }

    .container {
        padding: 0;
    }

    /* Header optimization: Compact single-row layout */
    header>div:first-child {
        flex-direction: row !important;
        align-items: center !important;
        justify-content: space-between !important;
        gap: 5px !important;
        /* Reduced gap */
        margin-bottom: 0.8rem !important;
        /* Tighter margin */
    }

    header>div:first-child>div:first-child {
        gap: 8px !important;
        /* Space between hamburger and title */
    }

    #sidebar-toggle {
        font-size: 1.1rem !important;
    }

    .cache-clear-blink {
        display: none !important;
    }

    .title-switcher {
        display: none !important;
    }

    .hide-on-mobile {
        display: none !important;
    }

    header {
        position: sticky;
        top: 0;
        z-index: 1000;
        background: rgba(15, 23, 42, 0.9);
        backdrop-filter: blur(15px);
        -webkit-backdrop-filter: blur(15px);
        margin: -0.5rem -1rem 1rem -1rem !important;
        width: auto !important;
        /* Compensate negative margins to reach full right edge */
        padding: 0.5rem clamp(3px, 1.5vw, 8px) !important;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    }

    .title-switcher {
        position: relative;
        height: 24px;
        overflow: hidden;
        display: flex;
        flex-direction: column;
        justify-content: center;
    }

    .sidebar-menu li a {
        flex-direction: column;
        justify-content: center;
        align-items: center;
        padding: 5px;
        gap: 2px;
        flex: 1;
        text-align: center;
    }

    /* Hide text labels on mobile bottom nav, show only icons */
    .sidebar-menu li a .title,
    .sidebar-menu li a span:not(.icon) {
        display: none !important;
    }

    .sidebar-menu li a .icon,
    .sidebar-menu li a span:first-child {
        font-size: 1.4rem;
        margin: 0;
    }

    .switcher-item {
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        opacity: 0;
        transform: translateY(10px);
        transition: all 0.5s ease;
        display: flex;
        align-items: center;
        pointer-events: none;
    }

    .switcher-item.active {
        opacity: 1;
        transform: translateY(0);
        pointer-events: auto;
    }

    header {
        position: sticky;
        top: 0;
        z-index: 1000;
        background: rgba(15, 23, 42, 0.85);
        backdrop-filter: blur(12px);
        -webkit-backdrop-filter: blur(12px);
        margin: -0.5rem -1rem 1rem -1rem !important;
        width: auto !important;
        /* Compensate negative margins to reach full right edge */
        padding: 0.8rem clamp(3px, 1.5vw, 8px) !important;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    }

    #auth-container {
        width: auto !important;
        margin-left: auto;
    }

    #user-profile {
        gap: 5px !important;
    }

    #user-name {
        display: block !important;
        max-width: 45px !important;
        /* Smaller profile name */
        font-size: 0.65rem !important;
        /* Smaller profile font */
    }

    #profile-trigger {
        padding: 4px 8px !important;
        gap: 4px !important;
    }

    #user-avatar {
        width: 22px !important;
        height: 22px !important;
    }

    .header-quick-link {
        padding: 4px !important;
        font-size: 0.9rem !important;
        min-width: 28px;
    }

    /* Navigation Ribbons: Smaller and less padding */
    .portfolio-nav,
    .sub-portfolio-nav {
        gap: 2px !important;
        margin-bottom: 0.4rem !important;
        padding-bottom: 4px !important;
        padding-top: 2px !important;
        border-radius: 10px !important;
    }

    .nav-tab {
        padding: 5px 12px !important;
        font-size: 0.85rem !important;
    }

    .sub-tab {
        padding: 2px 8px !important;
        font-size: 0.74rem !important;
        line-height: 1.2 !important;
        min-height: unset !important;
    }

    /* Compact section headers */
    .module-header h2 {
        font-size: 1.2rem !important;
    }

    .module-header p {
        font-size: 0.8rem !important;
    }

    @keyframes cacheBlink {

        0%,
        100% {
            opacity: 1;
            transform: scale(1);
        }

        50% {
            opacity: 0.7;
            transform: scale(0.98);
        }
    }
}

/* â”€â”€ Pulsating Warning Box (v5.0 Style) â”€â”€ */
.pulsating-warning-box {
    display: inline-block;
    background: rgba(255, 71, 87, 0.1);
    border: 1px solid rgba(255, 71, 87, 0.3);
    color: #ff4757;
    font-size: 0.8rem;
    font-weight: 700;
    padding: 6px 15px;
    border-radius: 20px;
    margin-top: 5px;
    animation: warningPulse 1.5s infinite ease-in-out;
    letter-spacing: 0.5px;
}

@keyframes warningPulse {
    0% {
        opacity: 0.8;
        transform: scale(1);
        box-shadow: 0 0 0px rgba(255, 71, 87, 0);
    }

    50% {
        opacity: 1;
        transform: scale(1.02);
        box-shadow: 0 0 10px rgba(255, 71, 87, 0.2);
    }

    100% {
        opacity: 0.8;
        transform: scale(1);
        box-shadow: 0 0 0px rgba(255, 71, 87, 0);
    }
}

.header-branding {
    text-align: center;
    padding: 0.1rem 0 0.2rem 0;
    width: 100%;
}

.header-branding h1 {
    font-size: 2.2rem;
    font-weight: 800;
    margin: 0;
    color: var(--header-text);
    /* Use mode-specific variable */
    letter-spacing: -1px;
}

.header-branding p {
    font-size: 1rem;
    color: var(--header-text);
    /* Use mode-specific variable */
    opacity: 0.8;
    margin: 2px 0 0 0;
}

/* Marquee Styles */
.header-marquee {
    margin: 0 0 8px 0;
    width: 100%;
    overflow: hidden;
    white-space: nowrap;
    background: rgba(239, 68, 68, 0.06);
    /* Reduced from 0.12 */
    border-top: 1px solid rgba(239, 68, 68, 0.2);
    border-bottom: 1px solid rgba(239, 68, 68, 0.2);
    padding: 3px 0;
    position: relative;
    z-index: 10;
}

#feedback-marquee-content {
    display: inline-block;
    animation: marquee 120s linear infinite;
    font-size: 0.7rem;
    font-weight: 600;
    color: #ef4444;
    will-change: transform;
    transform: translate3d(0, 0, 0);
    backface-visibility: hidden;
    perspective: 1000px;
}

body.light-mode .header-marquee {
    background: #fef2f2 !important;
    border-color: #fee2e2 !important;
}

body.light-mode #feedback-marquee-content {
    color: #991b1b !important;
}

.marquee-user-tag {
    color: var(--primary);
    font-weight: 700;
}

.marquee-time-tag {
    color: var(--text-muted);
    font-size: 0.75rem;
    margin-left: 4px;
}

.marquee-msg-tag {
    color: var(--text-main);
    font-style: italic;
    margin-left: 4px;
}

.marquee-reply-user {
    color: var(--secondary);
    font-weight: 600;
}

.marquee-reply-time {
    color: var(--text-muted);
    font-size: 0.7rem;
    margin-left: 4px;
}

.marquee-reply-msg {
    color: var(--text-main);
    margin-left: 4px;
}

@media (max-width: 768px) {
    .header-branding {
        padding: 0rem 0 0.2rem 0;
    }

    .header-branding h1 {
        font-size: 1.6rem;
        letter-spacing: -0.5px;
    }

    .header-branding p {
        font-size: 0.75rem;
    }

    .pulsating-warning-box {
        font-size: 0.6rem;
        padding: 4px 10px;
    }
}

/* Agent Messages Styling */
#agent-messages-list .msg-item.unread {
    border-left: 4px solid #3b82f6 !important;
}

#agent-messages-list .msg-item:hover {
    background: rgba(255, 255, 255, 0.06) !important;
}

@keyframes pulse-warn {
    0% {
        transform: scale(1);
        filter: drop-shadow(0 0 2px rgba(255, 107, 107, 0.5));
    }

    100% {
        transform: scale(1.1);
        filter: drop-shadow(0 0 10px rgba(255, 107, 107, 0.8));
    }
}

/* Segment Control (Toggle) */
.segment-control {
    display: flex;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 4px;
    gap: 4px;
    width: fit-content;
}

.segment-control input {
    display: none;
}

.segment-control label {
    padding: 8px 16px;
    border-radius: 8px;
    cursor: pointer;
    color: #888;
    font-size: 0.85rem;
    font-weight: 700;
    transition: all 0.2s;
    user-select: none;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.segment-control input:checked+label {
    background: rgba(59, 130, 246, 0.2);
    color: #3b82f6;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
}

.segment-control label:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.05);
}

/* Notification Animations */
@keyframes pulse-warn {
    from {
        opacity: 0.6;
        transform: scale(0.95);
    }

    to {
        opacity: 1;
        transform: scale(1.1);
        filter: drop-shadow(0 0 8px rgba(255, 71, 87, 0.8));
    }
}

.unread-dot {
    box-shadow: 0 0 10px rgba(255, 71, 87, 0.6);
}

.msg-item.unread {
    border-color: rgba(59, 130, 246, 0.4) !important;
    background: rgba(59, 130, 246, 0.05) !important;
}

/* --- PREMIUM SLIDER LAYOUT --- */
.slider-container-row {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 100%;
    margin-bottom: 20px;
}

.slider-label-row {
    font-size: 0.9rem;
    font-weight: bold;
    color: #fff;
    margin-bottom: 2px;
}

.slider-controls-row {
    display: flex;
    align-items: center;
    gap: 10px;
    justify-content: space-between;
}

.slider-stepper-group {
    display: flex;
    align-items: center;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    overflow: hidden;
    height: 38px;
}

.slider-stepper-group input {
    width: 60px;
    border: none;
    background: transparent;
    color: #fff;
    text-align: center;
    font-weight: bold;
    padding: 0;
    font-size: 1.1rem;
    height: 100%;
}

.slider-stepper-group button {
    background: rgba(255, 255, 255, 0.05);
    border: none;
    color: #fff;
    width: 32px;
    height: 100%;
    cursor: pointer;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.slider-stepper-group button:hover {
    background: rgba(255, 255, 255, 0.15);
}

.slider-full-row {
    width: 100%;
}

.slider-full-row input[type="range"] {
    width: 100% !important;
    margin-top: 5px;
    height: 10px;
}

.sticky-summary {
    position: sticky;
    bottom: 2rem;
    z-index: 10;
    backdrop-filter: blur(12px) !important;
    border: 1px solid rgba(255, 255, 255, 0.2) !important;
}

.slider-lock-btn {
    appearance: none !important;
    -webkit-appearance: none !important;
    background: rgba(255, 255, 255, 0.15) !important;
    border: 1px solid rgba(255, 255, 255, 0.35) !important;
    border-radius: 8px !important;
    padding: 8px 15px !important;
    color: #ffffff !important;
    cursor: pointer;
    font-size: 0.85rem !important;
    font-weight: 600 !important;
    display: none !important;
    /* Hide on desktop by default */
    align-items: center;
    justify-content: center;
    gap: 6px;
    white-space: nowrap;
    flex-shrink: 0;
    transition: all 0.2s;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    height: 38px;
    margin: 0 !important;
}

.slider-lock-btn:hover {
    background: rgba(255, 255, 255, 0.25) !important;
    border-color: rgba(255, 255, 255, 0.5) !important;
    transform: translateY(-1px);
}

.slider-lock-btn:active {
    transform: translateY(0);
    opacity: 0.8;
}

body.light-mode .slider-lock-btn {
    background: rgba(15, 23, 42, 0.08) !important;
    border: 1px solid rgba(15, 23, 42, 0.22) !important;
    color: #0f172a !important;
}

body.light-mode .slider-lock-btn:hover {
    background: rgba(15, 23, 42, 0.15) !important;
    border-color: rgba(15, 23, 42, 0.35) !important;
}

@media (max-width: 768px) {
    .locked-slider-mobile {
        opacity: 0.5;
        pointer-events: none;
        filter: grayscale(1);
        transition: all 0.3s;
    }

    .slider-lock-btn {
        display: inline-flex !important;
        /* Show only on mobile */
    }
}

/* On desktop, sliders should always be interactive */
@media (min-width: 769px) {
    .locked-slider-mobile {
        opacity: 1 !important;
        pointer-events: auto !important;
        filter: none !important;
    }
}

.unlocked,
.unlocked-slider,
input[type="range"].unlocked,
input[type="range"].unlocked-slider {
    opacity: 1 !important;
    pointer-events: auto !important;
    filter: none !important;
    cursor: pointer !important;
    touch-action: pan-x !important;
}

@media (max-width: 768px) {
    .slider-controls-row {
        gap: 8px;
        flex-wrap: nowrap !important;
        justify-content: flex-start !important;
    }

    .slider-stepper-group button {
        width: 32px;
    }

    .slider-stepper-group input {
        width: 52px;
        font-size: 1.1rem;
    }
}

@media (max-width: 380px) {
    .slider-controls-row {
        gap: 4px;
    }

    .slider-stepper-group input {
        width: 52px;
        font-size: 1rem;
    }

    .slider-lock-btn {
        font-size: 0.7rem !important;
        padding: 0 6px !important;
    }
}

/* More radical fix for very narrow screens */
@media (max-width: 420px) {
    .slider-controls-row {
        flex-wrap: nowrap !important;
        justify-content: flex-start;
        gap: 6px;
    }

    .slider-stepper-group input {
        width: 52px;
    }

    .slider-lock-btn {
        padding: 0 6px !important;
        font-size: 0.7rem !important;
    }
}

/* Indication for Horizontal Scrolling */
.portfolio-nav,
.sub-portfolio-nav,
.stat-pill-container {
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    /* Hide scrollbar but keep functionality */
}

.portfolio-nav::-webkit-scrollbar,
.sub-portfolio-nav::-webkit-scrollbar {
    display: none;
}

/* Dedicated SQMS Filter Ribbon for Reliable Mobile Scrolling */
.sqms-filter-ribbon {
    width: 100% !important;
    max-width: 100% !important;
    overflow-x: auto !important;
    overflow-y: hidden !important;
    display: block !important;
    -webkit-overflow-scrolling: touch !important;
    background: rgba(15, 23, 42, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    margin-bottom: 1rem;
    padding: 10px 15px 5px 15px !important;
    box-sizing: border-box !important;
    overscroll-behavior-x: contain;
    z-index: 5;
}

.sqms-filter-ribbon::-webkit-scrollbar {
    height: 6px;
    /* Slightly taller */
    display: block !important;
}

.sqms-filter-ribbon::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 4px;
}

.sqms-filter-ribbon::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    /* Brighter */
    border-radius: 4px;
}

.sqms-filter-inner {
    display: flex !important;
    align-items: center !important;
    justify-content: flex-start !important;
    min-width: max-content !important;
    gap: 20px !important;
    height: auto !important;
}

.sqms-filter-inner>* {
    flex-shrink: 0 !important;
}

/* Ensure Search Box doesn't shrink in the ribbon */
#sqms-search-input {
    width: 180px !important;
    flex-shrink: 0 !important;
}

@media (max-width: 600px) {
    .sqms-filter-ribbon {
        padding: 8px 10px !important;
    }

    .sqms-filter-inner {
        gap: 12px !important;
    }

    #sqms-search-input {
        width: 150px !important;
    }
}

/* Floating Labels Styling */
.floating-label-group {
    position: relative;
    margin-bottom: 1.5rem;
}

.floating-label-group label {
    position: absolute;
    top: 50%;
    left: 12px;
    transform: translateY(-50%);
    background: transparent;
    transition: all 0.2s ease;
    pointer-events: none;
    color: var(--text-muted);
    font-size: 0.95rem;
    padding: 0 4px;
}

.floating-label-group input:focus~label,
.floating-label-group input:not(:placeholder-shown)~label,
.floating-label-group select:focus~label,
.floating-label-group select:not([value=""])~label {
    top: 0;
    transform: translateY(-50%);
    font-size: 0.75rem;
    color: var(--primary);
    background: #1e293b;
    font-weight: 600;
}

/* Toggle Switch Styling */
.health-toggle-switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
}

.health-toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.health-toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(255, 255, 255, 0.05);
    transition: .3s;
    border-radius: 34px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.health-toggle-slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 2px;
    bottom: 2px;
    background-color: #cbd5e1;
    transition: .3s;
    border-radius: 50%;
}

.health-toggle-switch input:checked+.health-toggle-slider {
    background-color: var(--primary);
    border-color: var(--primary);
}

.health-toggle-switch input:checked+.health-toggle-slider:before {
    transform: translateX(20px);
    background-color: #0f172a;
}

/* Pulse Animation for PDF Button */
@keyframes pdfPulse {
    0% {
        box-shadow: 0 0 0 0 rgba(74, 222, 128, 0.4);
    }

    70% {
        box-shadow: 0 0 0 10px rgba(74, 222, 128, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(74, 222, 128, 0);
    }
}

.pulse-green {
    animation: pdfPulse 2s infinite;
}

/* Glow Bar */
#calc-glow-bar {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--primary), transparent);
    background-size: 200% 100%;
    z-index: 9999;
    opacity: 0;
    pointer-events: none;
}

.glow-active {
    animation: flash-glow 400ms ease-out forwards;
}

@keyframes flash-glow {
    0% {
        opacity: 0;
        background-position: 200% 0;
    }

    30% {
        opacity: 1;
    }

    70% {
        opacity: 1;
    }

    100% {
        opacity: 0;
        background-position: -200% 0;
    }
}

/* Desktop Sidebar & Summary Integration */
@media (min-width: 1024px) {
    .sidebar-sticky {
        position: fixed;
        left: 0;
        top: 0;
        bottom: 0;
        width: 240px;
        z-index: 1000;
        border-right: 1px solid var(--glass-border);
        background: #0f172a;
    }

    .floating-summary-container {
        position: sticky;
        top: 2rem;
        height: fit-content;
    }
}

/* Mobile Sticky Bar */
@media (max-width: 1023px) {
    .mobile-sticky-bottom-bar {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        background: rgba(15, 23, 42, 0.95);
        backdrop-filter: blur(12px);
        -webkit-backdrop-filter: blur(12px);
        border-top: 1px solid rgba(255, 255, 255, 0.1);
        padding: 12px 24px;
        display: flex;
        justify-content: space-between;
        align-items: center;
        z-index: 1500;
        box-shadow: 0 -4px 30px rgba(0, 0, 0, 0.5);
    }

    .mobile-sticky-bottom-bar.hidden {
        display: none !important;
    }

    .select-input,
    .input-field {
        min-height: 48px;
        /* Touch target improvement */
    }
}

/* Horizontal Nav for Health on Desktop */
@media (min-width: 1024px) {
    #sub-nav-health:not(.hidden) {
        display: flex !important;
        background: var(--glass-bg);
        border: 1px solid var(--glass-border);
        padding: 0.75rem;
        border-radius: 12px;
        margin-bottom: 2rem;
        gap: 12px;
        overflow-x: auto;
        box-shadow: var(--shadow);
    }

    #sub-nav-health .sub-tab {
        padding: 10px 20px;
        border-radius: 10px;
        font-weight: 700;
        font-size: 0.9rem;
        transition: all 0.3s ease;
        border: 1px solid transparent;
        color: var(--text-muted);
        white-space: nowrap;
    }

    #sub-nav-health .sub-tab.active {
        background: rgba(16, 185, 129, 0.15);
        border-color: rgba(16, 185, 129, 0.3);
        color: var(--primary);
    }

    #sub-nav-health .sub-tab:hover:not(.active) {
        background: rgba(255, 255, 255, 0.05);
        color: #fff;
    }

    #module-health {
        margin-left: 0;
        /* Align with portfolio ribbon */
        width: 100%;
        max-width: 1200px;
    }
}

/* Pulse Animation for PDF Button */
@keyframes pdfPulse {
    0% {
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.4);
    }

    70% {
        box-shadow: 0 0 0 15px rgba(16, 185, 129, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0);
    }
}

.pulse-green {
    animation: pdfPulse 2s infinite cubic-bezier(0.66, 0, 0, 1);
}

/* Calculation Glow Bar */
#calc-glow-bar {
    position: fixed;
    top: 0;
    left: 0;
    height: 4px;
    width: 0%;
    background: linear-gradient(90deg, #10b981, #34d399, #10b981);
    background-size: 200% 100%;
    z-index: 9999;
    box-shadow: 0 0 15px rgba(16, 185, 129, 0.5);
    transition: width 0.4s cubic-bezier(0.1, 0.7, 1.0, 0.1);
    pointer-events: none;
}

#calc-glow-bar.active {
    width: 100%;
    animation: glow-loading 1.5s linear infinite;
}

@keyframes glow-loading {
    0% {
        background-position: 0% 50%;
    }

    100% {
        background-position: 200% 50%;
    }
}

/* High Contrast Result Values */
.highlight-emerald {
    color: #10b981 !important;
    font-family: 'Inter', sans-serif;
    letter-spacing: -0.5px;
    text-shadow: 0 0 20px rgba(16, 185, 129, 0.2);
    font-weight: 800;
}


/* Light mode specific UI fixes */
body.light-mode .nav-tab {
    color: #4b5563 !important;
}

body.light-mode .nav-tab.active {
    color: #fff !important;
}

body.light-mode .sub-tab {
    color: #4b5563 !important;
    border-color: rgba(0, 0, 0, 0.2) !important;
}

body.light-mode .sub-tab:hover {
    color: #111827 !important;
    border-color: rgba(0, 0, 0, 0.4) !important;
    background: rgba(0, 0, 0, 0.05) !important;
}

body.light-mode .sub-tab.active {
    color: #fff !important;
    background: var(--primary) !important;
    border-color: var(--primary) !important;
}

body.light-mode .toggle-btn {
    color: #4b5563 !important;
}

body.light-mode .toggle-btn.active {
    color: #fff !important;
}

body.light-mode header p {
    color: #4b5563 !important;
}

body.light-mode .view-toggle {
    background: rgba(0, 0, 0, 0.05) !important;
}


/* Additional Contrast Fixes for Light Mode */

body.light-mode [id$="-intermediary-payout-box"],
body.light-mode [id$="-payout-box"] {
    background: #f1f5f9 !important;
    color: #1f2937 !important;
    border-color: #cbd5e1 !important;
}

body.light-mode [id$="-intermediary-payout-box"] div,
body.light-mode [id$="-intermediary-payout-box"] span,
body.light-mode [id$="-payout-box"] div,
body.light-mode [id$="-payout-box"] span {
    color: #334155 !important;
}

body.light-mode [id$="-intermediary-payout-box"] small,
body.light-mode [id$="-payout-box"] small {
    color: #64748b !important;
}

body.light-mode [id$="-intermediary-payout-box"] span[style*="#fcc15d"],
body.light-mode [id$="-payout-box"] span[style*="#fcc15d"],
body.light-mode [id$="-intermediary-payout-box"] div[style*="#fcc15d"],
body.light-mode [id$="-payout-box"] div[style*="#fcc15d"] {
    color: #d97706 !important;
}

body.light-mode [id$="-intermediary-payout-box"] div[style*="#3b82f6"],
body.light-mode [id$="-payout-box"] div[style*="#3b82f6"] {
    color: #0284c7 !important;
}

body.light-mode .result-row.total.highlight {
    background: #e0f2fe !important;
    border-color: #bae6fd !important;
}

body.light-mode .result-row.total.highlight span {
    color: #0f172a !important;
}

body.light-mode .result-row.total.highlight span[id$="-res-final"] {
    color: #0369a1 !important;
}

body.light-mode button[id$="-save-quote-btn"],
body.light-mode button[id$="-btn-save"] {
    color: #064e3b !important;
    background: #dcfce7 !important;
    border-color: #86efac !important;
}

body.light-mode .feedback-alert-msg {
    color: #b45309 !important;
    font-weight: 600 !important;
}

body.light-mode .pulsating-warning-box {
    color: #b91c1c !important;
    background: #fef2f2 !important;
    border-color: #fca5a5 !important;
}

/* Modal & General Text Darker Fixes */
body.light-mode label,
body.light-mode p,
body.light-mode span:not([style*="color: #fff"]):not([style*="color: #3b82f6"]),
body.light-mode .section-title,
body.light-mode .upload-text {
    color: var(--text-main);
}

/* Modals global */
body.light-mode [class*="modal"],
body.light-mode [id*="modal"] {
    background: #ffffff !important;
    color: #0f172a !important;
}

/* Matrix / Authority Modal inside Modals */
body.light-mode .matrix-container {
    background: #ffffff !important;
    color: #0f172a !important;
}

body.light-mode .matrix-container h3,
body.light-mode .matrix-container h4 {
    color: #b45309 !important;
    /* Dark amber */
    border-color: rgba(180, 83, 9, 0.3) !important;
}

body.light-mode .matrix-container ul,
body.light-mode .matrix-container li,
body.light-mode .matrix-container p,
body.light-mode .matrix-container span,
body.light-mode .matrix-container td,
body.light-mode .matrix-container th {
    color: #0f172a !important;
}

/* Fix specific backgrounds inside matrix */
body.light-mode .matrix-container div[style*="rgba(0,0,0,0.2)"],
body.light-mode .matrix-container div[style*="rgba(255,255,255,0.03)"],
body.light-mode .matrix-container div[style*="rgba(255,255,255,0.04)"] {
    background: #f1f5f9 !important;
    border-color: #cbd5e1 !important;
    color: #0f172a !important;
}

/* Red Notice */
body.light-mode .matrix-container div[style*="rgba(239, 68, 68, 0.1)"] {
    background: #fef2f2 !important;
    border-color: #fca5a5 !important;
}

body.light-mode .matrix-container div[style*="rgba(239, 68, 68, 0.1)"] p {
    color: #b91c1c !important;
}

/* Table */
body.light-mode .matrix-container table {
    background: #f8fafc !important;
}

body.light-mode .matrix-container tr {
    background: transparent !important;
}

body.light-mode .matrix-container th {
    color: #4338ca !important;
    background: #e0e7ff !important;
}

body.light-mode .matrix-container td {
    border-color: #cbd5e1 !important;
}

/* SIP / NON-SIP Boxes */
body.light-mode .matrix-container div[style*="rgba(52, 152, 219, 0.1)"] {
    background: #e0f2fe !important;
    border-color: #7dd3fc !important;
}

body.light-mode .matrix-container div[style*="rgba(52, 152, 219, 0.1)"] h4 {
    color: #0284c7 !important;
    border-color: #bae6fd !important;
}

body.light-mode .matrix-container div[style*="rgba(52, 152, 219, 0.1)"] ul {
    color: #0f172a !important;
}

body.light-mode .matrix-container div[style*="rgba(231, 76, 60, 0.1)"] {
    background: #fee2e2 !important;
    border-color: #fca5a5 !important;
}

body.light-mode .matrix-container div[style*="rgba(231, 76, 60, 0.1)"] h4 {
    color: #b91c1c !important;
    border-color: #fecaca !important;
}

body.light-mode .matrix-container div[style*="rgba(231, 76, 60, 0.1)"] ul {
    color: #0f172a !important;
}

/* --- ADDED IN THIS TURN --- */

/* Study Section (Learn More cards) Light Mode Contrast */
body.light-mode #study-container h3,
body.light-mode #study-container-car h3,
body.light-mode #study-container-cv h3,
body.light-mode .study-container h3,
body.light-mode .study-container-car h3 {
    color: #0f172a !important;
}

body.light-mode #study-container p,
body.light-mode #study-container-car p,
body.light-mode #study-container-cv p,
body.light-mode .study-container p,
body.light-mode .study-container-car p {
    color: #334155 !important;
}

body.light-mode .learn-more-btn {
    color: #0d9488 !important;
    /* Darker teal for button */
}

/* Info Modal Content Contrast */
body.light-mode #info-modal .modal-content {
    background: #ffffff !important;
    color: #1e293b !important;
}

body.light-mode #modal-title {
    color: #0f172a !important;
}

body.light-mode #modal-desc p,
body.light-mode .modal-body p {
    color: #1e293b !important;
}

body.light-mode #modal-desc h4 {
    color: #4338ca !important;
    /* Darker indigo/blue for subheadings */
}

body.light-mode #modal-desc p[style*="font-style: italic"] {
    color: #475569 !important;
    /* Scenario text */
}

body.light-mode #modal-desc li {
    color: #334155 !important;
}

/* Color overrides for 'With Cover' / 'Without Cover' boxes in modal */
body.light-mode #modal-desc div[style*="rgba(255, 94, 87, 0.05)"] {
    background: #fef2f2 !important;
    border-color: #fca5a5 !important;
}

body.light-mode #modal-desc div[style*="rgba(255, 94, 87, 0.05)"] strong {
    color: #b91c1c !important;
}

body.light-mode #modal-desc div[style*="rgba(255, 94, 87, 0.05)"] span {
    color: #0f172a !important;
}

body.light-mode #modal-desc div[style*="rgba(0, 210, 211, 0.05)"] {
    background: #f0fdfa !important;
    border-color: #99f6e4 !important;
}

body.light-mode #modal-desc div[style*="rgba(0, 210, 211, 0.05)"] strong {
    color: #0f766e !important;
}

body.light-mode #modal-desc div[style*="rgba(0, 210, 211, 0.05)"] span {
    color: #0f172a !important;
}

/* 'i' button icons in Light Mode */
body.light-mode .info-icon {
    color: #0284c7 !important;
}

/* Additional specific overrides for info matrix colors */
body.light-mode #modal-desc h4[style*="color:#2ecc71"] {
    color: #15803d !important;
}

body.light-mode #modal-desc h4[style*="color:#ff7675"] {
    color: #b91c1c !important;
}

body.light-mode #modal-desc ul[style*="color:#ccc"] {
    color: #334155 !important;
}

/* --- ADDED FOR DISTINGUISHED BORDERS & SQMS LEGIBILITY --- */

/* Global Border Darkening in Light Mode for better classification */
body.light-mode .upload-section,
body.light-mode .left-column,
body.light-mode .right-column,
body.light-mode .modal-content,
body.light-mode .addon-row,
body.light-mode .result-row,
body.light-mode .payout-box,
body.light-mode .intermediary-payout-box,
body.light-mode .info-modal .modal-content {
    border-color: rgba(0, 0, 0, 0.25) !important;
}

body.light-mode .upload-section {
    border: 1px solid rgba(0, 0, 0, 0.2) !important;
    background: rgba(0, 0, 0, 0.02) !important;
}

/* SQMS Table & Monitor in Light Mode */
body.light-mode .sqms-table {
    color: #1e293b !important;
}

body.light-mode .sqms-table th {
    background: #f1f5f9 !important;
    color: #0f172a !important;
    border-bottom: 2px solid #cbd5e1 !important;
}

body.light-mode .sqms-table td {
    border-bottom-color: #e2e8f0 !important;
    color: #334155 !important;
}

body.light-mode .sqms-row:hover {
    background: #f8fafc !important;
}

body.light-mode .sqms-row.active-row {
    background: #f1f5f9 !important;
    border-left: 4px solid #4f46e5 !important;
}

/* SQMS Detailed View Modals */
body.light-mode .sqms-detail-grid strong {
    color: #0f172a !important;
}

body.light-mode .sqms-detail-grid span {
    color: #1e293b !important;
}

body.light-mode .sqms-detail-grid div {
    border-color: #e2e8f0 !important;
}

/* SQMS Chat / Messaging in Light Mode */
body.light-mode .sqms-chat-window,
body.light-mode [id*="chat-window"] {
    background: #ffffff !important;
    border: 1px solid #94a3b8 !important;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2) !important;
}

body.light-mode .sqms-chat-header,
body.light-mode [class*="chat-header"] {
    background: #f1f5f9 !important;
    border-bottom: 1px solid #cbd5e1 !important;
    color: #0f172a !important;
}

body.light-mode .sqms-chat-body,
body.light-mode [class*="chat-body"] {
    background: #f8fafc !important;
}

body.light-mode .chat-msg {
    color: #1e293b !important;
}

body.light-mode .chat-msg-wrapper.mine .chat-msg {
    background: #4f46e5 !important;
    color: #ffffff !important;
}

body.light-mode .chat-msg-wrapper.others .chat-msg {
    background: #ffffff !important;
    color: #0f172a !important;
    border: 1px solid #cbd5e1 !important;
}

body.light-mode .chat-meta {
    color: #64748b !important;
}

body.light-mode .sqms-chat-footer,
body.light-mode [class*="chat-footer"] {
    background: #ffffff !important;
    border-top: 1px solid #e2e8f0 !important;
}

body.light-mode .chat-input,
body.light-mode [class*="chat-input"] {
    background: #f1f5f9 !important;
    border: 1px solid #cbd5e1 !important;
    color: #0f172a !important;
}

/* Distinction for input groups in Light Mode */
body.light-mode .input-group,
body.light-mode .form-group {
    border-bottom: 1px solid rgba(0, 0, 0, 0.1) !important;
    padding-bottom: 8px;
    margin-bottom: 12px;
}

/* Tick Boxes Legibility in Light Mode (TW/CV Optimization) */
body.light-mode .checkmark {
    background-color: rgba(0, 0, 0, 0.1) !important;
    border: 1px solid rgba(0, 0, 0, 0.3) !important;
}

body.light-mode .checkbox-container:hover input~.checkmark {
    background-color: rgba(0, 0, 0, 0.15) !important;
}

body.light-mode .checkbox-container input:checked~.checkmark {
    background-color: #4f46e5 !important;
    border-color: #4f46e5 !important;
}

body.light-mode .checkbox-container .checkmark:after {
    border-color: white !important;
}

/* Profile Modal Contrast Fixes */
body.light-mode #profile-modal .modal-content {
    background: #ffffff !important;
    color: #1e293b !important;
}

body.light-mode #profile-modal .modal-header {
    border-bottom: 2px solid #e2e8f0 !important;
}

body.light-mode #profile-modal h2,
body.light-mode #profile-modal h3 {
    color: #0f172a !important;
}

body.light-mode #profile-modal p {
    color: #475569 !important;
}

body.light-mode #profile-name,
body.light-mode #profile-mobile,
body.light-mode #profile-email,
body.light-mode #profile-photo,
body.light-mode #profile-payment-details {
    background: #f8fafc !important;
    border: 1px solid #cbd5e1 !important;
    color: #0f172a !important;
}

body.light-mode #profile-email:disabled {
    background: #f1f5f9 !important;
    color: #64748b !important;
}

body.light-mode #profile-msg-header {
    color: #0369a1 !important;
}

body.light-mode #unread-msg-count-profile {
    background: #b91c1c !important;
}

/* Sidebar Light Mode Fixes */
body.light-mode .sidebar {
    background: #f8fafc !important;
    border-right: 1px solid #cbd5e1 !important;
}

body.light-mode .sidebar-menu a {
    color: #334155 !important;
    font-weight: 500 !important;
}

body.light-mode .sidebar-menu li:not(.active) a {
    color: #475569 !important;
    opacity: 0.9;
}

body.light-mode .sidebar-menu a:hover,
body.light-mode .sidebar-menu li.active a {
    background: rgba(79, 70, 229, 0.1) !important;
    color: #4f46e5 !important;
    font-weight: 700 !important;
}

body.light-mode .sidebar-section-title {
    color: #64748b !important;
    border-bottom-color: rgba(0, 0, 0, 0.1) !important;
}

body.light-mode .sidebar-header h3 {
    color: #0f172a !important;
}

body.light-mode .sidebar-header {
    border-bottom-color: rgba(0, 0, 0, 0.1) !important;
}

/* Health Module Light Mode Fixes */
body.light-mode #module-health-container,
body.light-mode #module-health {
    color: #1e293b !important;
}

body.light-mode .member-card {
    background: #ffffff !important;
    border: 1px solid #cbd5e1 !important;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05) !important;
}

body.light-mode .member-card label {
    color: #334155 !important;
}

body.light-mode .member-card span[id*="age-display"] {
    color: #059669 !important;
}

body.light-mode .member-card .floating-label-group label {
    color: #64748b !important;
    background: #ffffff !important;
}

body.light-mode .select-input,
body.light-mode .input-field {
    background: #f8fafc !important;
    border: 1px solid #cbd5e1 !important;
    color: #0f172a !important;
}

body.light-mode .health-calculator-header h2,
body.light-mode .health-calculator-header h1 {
    color: #059669 !important;
}

body.light-mode .premium-summary-card {
    background: #f1f5f9 !important;
    border: 1px solid #cbd5e1 !important;
}

body.light-mode .floating-summary-card {
    background: #ffffff !important;
    border: 1px solid #cbd5e1 !important;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1) !important;
}

body.light-mode .floating-summary-card h3 {
    color: #0f172a !important;
}

body.light-mode .floating-summary-card span {
    color: #1e293b !important;
}

body.light-mode .highlight-emerald {
    color: #059669 !important;
    text-shadow: none !important;
}

body.light-mode .stat-label,
body.light-mode .res-label {
    color: #334155 !important;
}

/* SQMS Standalone / Separate Theme Support */
#module-sqms.sqms-light-mode {
    background: #f8fafc !important;
    color: #1e293b !important;
}

.sqms-light-mode .glass-panel {
    background: #ffffff !important;
    border-color: #cbd5e1 !important;
    color: #1e293b !important;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05) !important;
}

.sqms-light-mode .sqms-table {
    color: #000000 !important;
}

.sqms-light-mode .sqms-table th {
    background: #f1f5f9 !important;
    color: #000000 !important;
    border-bottom: 2px solid #cbd5e1 !important;
    font-weight: 700 !important;
}

.sqms-light-mode .sqms-table td {
    border-bottom: 1px solid #e2e8f0 !important;
    color: #000000 !important;
}

.sqms-light-mode .sqms-row:hover {
    background: #f8fafc !important;
}

.sqms-light-mode .sqms-row.active-row {
    background: #f1f5f9 !important;
    border-left: 4px solid #4f46e5 !important;
}

.sqms-light-mode .sqms-chat-window {
    background: #ffffff !important;
    border-color: #cbd5e1 !important;
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.15) !important;
}

.sqms-light-mode .sqms-chat-body {
    background: #f8fafc !important;
}

.sqms-light-mode .sqms-chat-footer {
    background: #f1f5f9 !important;
    border-top: 1px solid #e2e8f0 !important;
}

.sqms-light-mode .chat-input {
    background: #ffffff !important;
    color: #1e293b !important;
    border: 1px solid #cbd5e1 !important;
}

.sqms-light-mode .chat-msg-wrapper.mine .chat-msg {
    background: linear-gradient(135deg, #4f46e5 0%, #4338ca 100%) !important;
}

.sqms-light-mode .sqms-chat-header {
    background: #f1f5f9 !important;
    color: #0f172a !important;
    border-bottom-color: #cbd5e1 !important;
}

.sqms-light-mode .chat-msg-wrapper.others .chat-msg {
    background: #f1f5f9 !important;
    color: #1e293b !important;
    border: 1px solid #cbd5e1 !important;
}

.sqms-light-mode .sqms-side-pane {
    background: #ffffff !important;
    border-left-color: #cbd5e1 !important;
    color: #1e293b !important;
}

.sqms-light-mode .sqms-detail-view {
    color: #1e293b !important;
}

.sqms-light-mode .sqms-detail-view .modal-header {
    background: #f8fafc !important;
    border-bottom: 1px solid #e2e8f0 !important;
}

.sqms-light-mode .sqms-detail-view .modal-footer {
    background: #f8fafc !important;
    border-top: 1px solid #e2e8f0 !important;
}

.sqms-light-mode .sqms-detail-view label {
    color: #334155 !important;
    /* Darker slate for better contrast */
    font-weight: 600;
}

.sqms-light-mode .sqms-detail-view textarea,
.sqms-light-mode .sqms-detail-view .info-group div,
.sqms-light-mode .sqms-detail-view .select-input {
    background: #f8fafc !important;
    color: #0f172a !important;
    border: 1px solid #cbd5e1 !important;
}

.sqms-light-mode #sqms-static-header {
    background: #f8fafc !important;
    border-bottom-color: #cbd5e1 !important;
    color: #000000 !important;
}

.sqms-light-mode .stat-pill {
    background: #f1f5f9 !important;
    color: #475569 !important;
    border: 1px solid #cbd5e1 !important;
}

.sqms-light-mode .stat-pill.active {
    background: #4f46e5 !important;
    color: #ffffff !important;
}

.sqms-light-mode .count-badge {
    background: rgba(0, 0, 0, 0.05) !important;
    color: #1e293b !important;
}

.sqms-light-mode .stat-pill.active .count-badge {
    background: rgba(255, 255, 255, 0.2) !important;
    color: #ffffff !important;
}

.sqms-light-mode #sqms-search-input {
    background: #ffffff !important;
    color: #0f172a !important;
    border-color: #cbd5e1 !important;
}


.sqms-light-mode #sqms-clearance-status {
    background: #ffffff !important;
    border: 1px solid #cbd5e1 !important;
    color: #1e293b !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05) !important;
}

.sqms-light-mode #sqms-clearance-status.clearance-green {
    color: #059669 !important;
    border-color: #059669 !important;
}

.sqms-light-mode #sqms-clearance-status.clearance-green input {
    color: #059669 !important;
}

.sqms-light-mode #sqms-clearance-status.clearance-blue {
    color: #0284c7 !important;
    border-color: #0284c7 !important;
}

.sqms-light-mode #sqms-clearance-status.clearance-blue input {
    color: #0284c7 !important;
}

.sqms-light-mode #sqms-clearance-status.clearance-red {
    color: #dc2626 !important;
    border-color: #dc2626 !important;
}

.sqms-light-mode #sqms-clearance-status.clearance-red input {
    color: #dc2626 !important;
}

.sqms-light-mode #next-clearance-time {
    color: #0f172a !important;
    /* Darkest text */
    background: #e2e8f0 !important;
    /* Slightly darker bg for pill */
    border-radius: 4px !important;
    padding: 2px 8px !important;
    border: 1px solid #94a3b8 !important;
    font-weight: 700 !important;
    /* Bolder */
}

.sqms-light-mode #sqms-clearance-label {
    color: #475569 !important;
}


/* SQMS Header Legibility (Light Mode) */
.sqms-light-mode .module-header h2 {
    color: #4338ca !important;
    /* Deep Indigo */
}

.sqms-light-mode .module-header p {
    color: #475569 !important;
    /* Slate */
}

.sqms-light-mode .module-header .glass-btn-sm {
    background: #ffffff !important;
    color: #1e293b !important;
    border: 1px solid #cbd5e1 !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1) !important;
}

.sqms-light-mode .module-header .glass-btn-sm:hover {
    background: #f1f5f9 !important;
    border-color: #94a3b8 !important;
}

/* Modal Light Mode Overrides */
.sqms-light-mode #sqms-add-modal .modal-content {
    background: #ffffff !important;
    color: #000000 !important;
    border-color: #cbd5e1 !important;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04) !important;
}

.sqms-light-mode #sqms-add-modal .modal-header {
    background: #f8fafc !important;
    border-bottom: 1px solid #e2e8f0 !important;
}

.sqms-light-mode #sqms-add-modal .modal-header h2 {
    color: #4f46e5 !important;
}

.sqms-light-mode #sqms-add-modal .modal-body label {
    color: #475569 !important;
}

.sqms-light-mode #sqms-add-modal .input-field,
.sqms-light-mode #sqms-add-modal .select-input,
.sqms-light-mode #sqms-add-modal input[type="text"],
.sqms-light-mode #sqms-add-modal input[type="date"],
.sqms-light-mode #sqms-add-modal select,
.sqms-light-mode #sqms-add-modal textarea {
    background: #f8fafc !important;
    color: #0f172a !important;
    border: 1px solid #cbd5e1 !important;
}

.sqms-light-mode #sqms-add-modal input[type="date"] {
    color-scheme: light !important;
}

.sqms-light-mode #sqms-add-modal .input-group[style*="background: rgba(16, 185, 129, 0.03)"] {
    background: #f0fdf4 !important;
    border-color: #bbf7d0 !important;
}

.sqms-light-mode #sqms-add-modal .input-group[style*="background: rgba(250, 204, 21, 0.05)"] {
    background: #fefce8 !important;
    border-color: #fef08a !important;
}

.sqms-light-mode #sqms-add-modal .input-group p {
    color: #64748b !important;
}

/* Modal Footer Buttons */
.sqms-light-mode #sqms-add-modal button[onclick*="closeAddRequestModal"] {
    background: #f1f5f9 !important;
    color: #475569 !important;
    border-color: #cbd5e1 !important;
}

.sqms-light-mode #sqms-add-modal button[onclick*="submitAndAddAnother"] {
    background: #f8fafc !important;
    color: #1e293b !important;
    border-color: #cbd5e1 !important;
}

/* Lite Mode toggle labels */
.sqms-light-mode #sqms-add-modal span[style*="color:#aaa"] {
    color: #64748b !important;
}

.sqms-light-mode #sqms-add-modal .input-group label {
    color: #334155 !important;
    /* Darker slate */
}

.sqms-light-mode #sqms-add-modal .input-group label[style*="color:#facc15"] {
    color: #b45309 !important;
    /* Darker amber */
}

.sqms-light-mode #sqms-add-modal #lite-req-remark,
.sqms-light-mode #sqms-add-modal #new-req-remark {
    background: #ffffff !important;
    color: #0f172a !important;
    border-color: #cbd5e1 !important;
}

.sqms-light-mode #sqms-add-modal .input-group[style*="background: rgba(16, 185, 129, 0.03)"] input[type="file"] {
    color: #475569 !important;
}

.sqms-light-mode #sqms-add-modal .sqms-current-doc-pill {
    background: #e0f2fe !important;
    border-color: #7dd3fc !important;
}

.sqms-light-mode #sqms-add-modal .sqms-current-doc-pill span {
    color: #0284c7 !important;
}

#sqms-add-modal .sqms-doc-upload-bar {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    justify-content: space-between !important;
    flex-wrap: wrap !important;
    gap: 8px !important;
    padding: 5px 10px !important;
}

#sqms-add-modal .sqms-doc-upload-bar input[type="file"] {
    padding: 2px 6px !important;
    height: 28px !important;
    min-height: 28px !important;
    max-height: 28px !important;
    font-size: 0.76rem !important;
    line-height: 22px !important;
    width: auto !important;
    flex: 1 1 0% !important;
    min-width: 150px !important;
    box-sizing: border-box !important;
    margin: 0 !important;
}

#sqms-add-modal .sqms-doc-upload-bar input[type="file"]::file-selector-button {
    padding: 2px 8px !important;
    font-size: 0.72rem !important;
    margin-right: 6px !important;
    height: 22px !important;
    line-height: 18px !important;
}

/* Table Grouping Header Light Mode */
.sqms-light-mode .group-header {
    background: #f1f5f9 !important;
    border-top: 2px solid #cbd5e1 !important;
}

.sqms-light-mode .group-header .status-badge {
    background: #475569 !important;
    color: #ffffff !important;
}

.sqms-light-mode .group-header span[style*="color:#888"] {
    color: #64748b !important;
}

/* Date/Time Field Value Visibility Fix (Light Mode) */
body.light-mode input[type="date"]::-webkit-datetime-edit,
body.light-mode input[type="date"]::-webkit-datetime-edit-fields-wrapper,
body.light-mode input[type="date"]::-webkit-datetime-edit-text,
body.light-mode input[type="date"]::-webkit-datetime-edit-month-field,
body.light-mode input[type="date"]::-webkit-datetime-edit-day-field,
body.light-mode input[type="date"]::-webkit-datetime-edit-year-field,
body.light-mode input[type="time"]::-webkit-datetime-edit-text,
body.light-mode input[type="time"]::-webkit-datetime-edit-hour-field,
body.light-mode input[type="time"]::-webkit-datetime-edit-minute-field,
body.light-mode input[type="time"]::-webkit-datetime-edit-ampm-field,
body.light-mode input[type="datetime-local"]::-webkit-datetime-edit-text,
body.light-mode input[type="datetime-local"]::-webkit-datetime-edit-month-field,
body.light-mode input[type="datetime-local"]::-webkit-datetime-edit-day-field,
body.light-mode input[type="datetime-local"]::-webkit-datetime-edit-year-field,
body.light-mode input[type="datetime-local"]::-webkit-datetime-edit-hour-field,
body.light-mode input[type="datetime-local"]::-webkit-datetime-edit-minute-field,
body.light-mode input[type="datetime-local"]::-webkit-datetime-edit-ampm-field {
    color: #0f172a !important;
    font-weight: 600 !important;
}

body.light-mode input[type="date"]::-webkit-calendar-picker-indicator,
body.light-mode input[type="time"]::-webkit-calendar-picker-indicator,
body.light-mode input[type="datetime-local"]::-webkit-calendar-picker-indicator {
    cursor: pointer !important;
    opacity: 0.9 !important;
    filter: none !important;
    width: 20px !important;
    height: 20px !important;
}

/* Stepper Buttons Light Mode (+ / -) */
body.light-mode .stepper-btn,
body.light-mode .slider-stepper-group button {
    background: #f8fafc !important;
    /* Slightly off-white */
    color: #000000 !important;
    border: 1.5px solid #94a3b8 !important;
    /* Solid Slate border */
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05) !important;
}

body.light-mode .stepper-btn:active,
body.light-mode .slider-stepper-group button:active {
    background: #e2e8f0 !important;
    transform: scale(0.95);
}

body.light-mode .slider-stepper-group {
    background: #f8fafc !important;
    border-color: #cbd5e1 !important;
}

body.light-mode .slider-stepper-group input {
    color: #0f172a !important;
}

body.light-mode .info-icon {
    color: #6366f1 !important;
    /* Indigo for contrast */
}

/* Policy Age & Seating Warnings */
.policy-age-warning {
    margin-top: 8px;
    padding: 10px;
    background: rgba(241, 196, 15, 0.1);
    border-left: 4px solid #f1c40f;
    color: #f1c40f;
    font-size: 0.85rem;
    border-radius: 4px;
    line-height: 1.4;
    display: none;
}

#cv-seats-warning {
    color: #f1c40f;
    font-size: 0.8rem;
    margin-left: 10px;
    font-weight: 900;
}

/* Light Mode Overrides for Warnings */
body.light-mode .policy-age-warning {
    background: #fffbeb !important;
    /* Amber 50 */
    border-left-color: #f59e0b !important;
    /* Amber 500 */
    color: #92400e !important;
    /* Amber 800 */
    border: 1px solid rgba(245, 158, 11, 0.3) !important;
    border-left: 4px solid #f59e0b !important;
}

body.light-mode #cv-seats-warning {
    color: #b45309 !important;
    /* Amber 700 */
    text-shadow: none !important;
}


/* GCV RTO Chips Refined */
.rto-chip {
    display: inline-block;
    padding: 1px 4px;
    margin: 2px 1px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 3px;
    cursor: pointer !important;
    /* Pointed Palm */
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    font-weight: 500;
    font-size: 0.65rem;
}

.rto-chip:hover {
    background: var(--primary);
    color: #000 !important;
    transform: translateY(-1px);
    box-shadow: 0 0 10px var(--primary);
}

.light-mode .rto-chip {
    background: rgba(0, 0, 0, 0.05);
    border-color: rgba(0, 0, 0, 0.1);
    color: #333;
}

.light-mode .rto-chip:hover {
    background: var(--primary);
    color: #fff !important;
}

#cv-gcv-rto-reset {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #ef4444;
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 0.65rem;
    cursor: pointer;
    transition: all 0.2s;
    font-weight: bold;
    margin-left: auto;
}

#cv-gcv-rto-reset:hover {
    background: #ef4444;
    color: #fff;
}

.light-mode #cv-gcv-rto-container {
    background: rgba(168, 85, 247, 0.05) !important;
    border-color: rgba(168, 85, 247, 0.3) !important;
}

.light-mode #cv-gcv-rto-container strong {
    color: #1e293b !important;
}

.light-mode #cv-gcv-rto-container span[style*="color: #a855f7"] {
    color: #7c3aed !important;
    /* Darker purple */
}

body.light-mode .payout-container,
body.light-mode .payout-box,
body.light-mode .intermediary-payout-box {
    background: var(--res-payout-bg) !important;
    border-color: var(--res-border) !important;
    color: var(--res-label) !important;
}

body.light-mode .payout-container span,
body.light-mode .payout-box span,
body.light-mode .intermediary-payout-box span {
    color: var(--res-value) !important;
}

body.light-mode #tw-addon-breakdown,
body.light-mode #car-addon-breakdown,
body.light-mode #addon-list-container {
    color: var(--res-sub-label) !important;
}

.total-idv-value {
    color: var(--secondary) !important;
    text-shadow: 0 0 5px rgba(45, 212, 191, 0.2);
    font-family: var(--font-family);
    letter-spacing: 0.5px;
}

body.light-mode .total-idv-value {
    color: #0d9488 !important;
    text-shadow: none !important;
}

/* Modal Visibility Overrides (Light Mode) */
body.light-mode .modal-content {
    background: #ffffff !important;
    border-color: #cbd5e1 !important;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.15) !important;
}

body.light-mode #agent-modal h2,
body.light-mode #agent-modal-title,
body.light-mode #modal-title {
    background: none !important;
    -webkit-text-fill-color: var(--text-main) !important;
    color: var(--text-main) !important;
    border-bottom: 2px solid rgba(0, 0, 0, 0.1) !important;
}

body.light-mode #agent-modal label {
    color: #475569 !important;
}

body.light-mode #agent-modal input {
    background: #ffffff !important;
    border-color: #cbd5e1 !important;
    color: #1e293b !important;
}

body.light-mode .close-modal-x,
body.light-mode .close-modal {
    color: #64748b !important;
}

/* Ensure disabled input time is legible in sqms light mode */
.sqms-light-mode #next-clearance-time:disabled {
    color: #0f172a !important;
    -webkit-text-fill-color: #0f172a !important;
    opacity: 1 !important;
}

.sqms-light-mode #next-clearance-time::-webkit-datetime-edit-text,
.sqms-light-mode #next-clearance-time::-webkit-datetime-edit-hour-field,
.sqms-light-mode #next-clearance-time::-webkit-datetime-edit-minute-field,
.sqms-light-mode #next-clearance-time::-webkit-datetime-edit-ampm-field {
    color: #0f172a !important;
    -webkit-text-fill-color: #0f172a !important;
}

body.light-mode #saodDaysCalc,
body.light-mode #car-saodDaysCalc,
body.light-mode #saodWarning,
body.light-mode #car-saodWarning {
    color: #15803d !important;
    text-shadow: none !important;
}

/* SAOD Policy End Date Frozen, Lock Badge, and Tooltip styles */
.saod-end-date-frozen {
    cursor: not-allowed !important;
    background: rgba(255, 255, 255, 0.05) !important;
    opacity: 0.85 !important;
    border-style: dashed !important;
}

body.light-mode .saod-end-date-frozen {
    background: #f1f5f9 !important;
    color: #64748b !important;
    border-color: #cbd5e1 !important;
}

/* SAOD Lock Badge (Visible in both Dark and Light Mode) */
.saod-lock-badge {
    display: inline-flex !important;
    align-items: center;
    gap: 4px;
    font-size: 0.82rem !important;
    font-weight: 600 !important;
    padding: 2px 8px !important;
    border-radius: 6px !important;
    background: rgba(14, 165, 233, 0.18) !important;
    color: #38bdf8 !important;
    border: 1px solid rgba(56, 189, 248, 0.45) !important;
    box-shadow: 0 0 10px rgba(56, 189, 248, 0.25) !important;
    vertical-align: middle;
    margin-left: 6px;
    line-height: 1.3;
}

body.light-mode .saod-lock-badge {
    background: #e0f2fe !important;
    color: #0369a1 !important;
    border: 1px solid #7dd3fc !important;
    box-shadow: 0 1px 3px rgba(3, 105, 161, 0.15) !important;
}

.saod-freeze-bubble {
    background: #0f172a !important;
    color: #f8fafc !important;
    padding: 10px 16px !important;
    border-radius: 8px !important;
    font-size: 0.84rem !important;
    font-weight: 500 !important;
    border: 1.5px solid #38bdf8 !important;
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.6), 0 0 15px rgba(56, 189, 248, 0.35) !important;
    pointer-events: none;
    animation: saodTooltipPop 0.2s ease-out;
    max-width: 320px;
    line-height: 1.4;
}

body.light-mode .saod-freeze-bubble {
    background: #ffffff !important;
    color: #0f172a !important;
    border: 1.5px solid #0284c7 !important;
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.18), 0 0 10px rgba(2, 132, 199, 0.2) !important;
}

@keyframes saodTooltipPop {
    from {
        opacity: 0;
        transform: translateY(6px) scale(0.96);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.saod-freeze-bubble.fade-out {
    opacity: 0;
    transform: translateY(-4px);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

/* --- Easy Mode Toggle & Checkbox (Crisp contrast in Light & Dark Mode) --- */
.lite-mode-toggle {
    display: inline-flex !important;
    align-items: center !important;
    gap: 6px !important;
    margin-left: 10px !important;
    cursor: pointer !important;
    background: rgba(255, 255, 255, 0.08) !important;
    padding: 5px 12px !important;
    border-radius: 20px !important;
    font-size: 0.85rem !important;
    font-weight: 600 !important;
    color: #f1f5f9 !important;
    border: 1.5px solid rgba(255, 255, 255, 0.22) !important;
    transition: all 0.2s ease !important;
    user-select: none !important;
    vertical-align: middle !important;
}

.lite-mode-toggle:hover {
    background: rgba(255, 255, 255, 0.14) !important;
    border-color: rgba(255, 255, 255, 0.35) !important;
    color: #ffffff !important;
}

.lite-mode-toggle:has(input:checked),
.lite-mode-toggle.active {
    background: rgba(245, 158, 11, 0.2) !important;
    border-color: #f59e0b !important;
    color: #fef08a !important;
    box-shadow: 0 0 12px rgba(245, 158, 11, 0.3) !important;
}

#lite-mode-checkbox {
    width: 16px !important;
    height: 16px !important;
    min-width: 16px !important;
    min-height: 16px !important;
    cursor: pointer !important;
    accent-color: #f59e0b !important;
    margin: 0 !important;
    flex-shrink: 0 !important;
    vertical-align: middle !important;
}

body.light-mode .lite-mode-toggle {
    background: #ffffff !important;
    border: 1.5px solid #cbd5e1 !important;
    color: #334155 !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06) !important;
}

body.light-mode .lite-mode-toggle:hover {
    background: #f8fafc !important;
    border-color: #94a3b8 !important;
    color: #0f172a !important;
}

body.light-mode .lite-mode-toggle:has(input:checked),
body.light-mode .lite-mode-toggle.active {
    background: #fef3c7 !important;
    border-color: #d97706 !important;
    color: #92400e !important;
    box-shadow: 0 2px 6px rgba(217, 119, 6, 0.18) !important;
}

body.light-mode #lite-mode-checkbox {
    accent-color: #d97706 !important;
}

/* --- Kunjunni Chip & Insure Local Branding Styles --- */
.kunjunni-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-left: 6px;
    cursor: pointer;
    background: rgba(20, 184, 166, 0.08);
    padding: 4px 11px;
    border-radius: 20px;
    font-size: 0.82rem;
    font-weight: 600;
    color: #ccfbf1;
    border: 1.5px solid rgba(45, 212, 191, 0.35);
    transition: all 0.2s ease;
    white-space: nowrap;
    user-select: none;
    vertical-align: middle;
    height: 32px;
    align-self: center;
}

.kunjunni-chip.hidden,
.uplift-plan-chip.hidden,
[data-product="uplift-plan"].hidden,
[data-product="kunjunni-calc"].hidden,
[data-product="insure-local"].hidden {
    display: none !important;
}

.kunjunni-chip:hover {
    background: rgba(20, 184, 166, 0.18) !important;
    border-color: rgba(45, 212, 191, 0.6) !important;
    color: #ffffff !important;
    box-shadow: 0 0 10px rgba(45, 212, 191, 0.25) !important;
}

.kunjunni-chip.active {
    background: rgba(19, 78, 72, 0.45) !important;
    border-color: #2dd4bf !important;
    color: #5eead4 !important;
    box-shadow: 0 0 12px rgba(45, 212, 191, 0.4) !important;
    font-weight: 700 !important;
}

.kunjunni-brand-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border-radius: 5px;
    background: linear-gradient(140deg, #087768, #174d62);
    color: #ffffff;
    font-size: 0.72rem;
    font-weight: 800;
    line-height: 1;
    flex-shrink: 0;
    box-shadow: 0 1px 3px rgba(8, 119, 104, 0.4);
}

.uplift-plan-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-left: 6px;
    cursor: pointer;
    background: rgba(14, 165, 233, 0.08);
    padding: 4px 11px;
    border-radius: 20px;
    font-size: 0.82rem;
    font-weight: 600;
    color: #bae6fd;
    border: 1.5px solid rgba(56, 189, 248, 0.35);
    transition: all 0.2s ease;
    white-space: nowrap;
    user-select: none;
    vertical-align: middle;
    height: 32px;
    align-self: center;
}

.uplift-plan-chip:hover {
    background: rgba(14, 165, 233, 0.18) !important;
    border-color: rgba(56, 189, 248, 0.6) !important;
    color: #ffffff !important;
    box-shadow: 0 0 10px rgba(56, 189, 248, 0.25) !important;
}

.uplift-plan-chip.active {
    background: rgba(3, 105, 161, 0.45) !important;
    border-color: #38bdf8 !important;
    color: #7dd3fc !important;
    box-shadow: 0 0 12px rgba(56, 189, 248, 0.4) !important;
    font-weight: 700 !important;
}

.uplift-plan-brand-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border-radius: 5px;
    background: linear-gradient(140deg, #0284c7, #1e40af);
    color: #ffffff;
    font-size: 0.72rem;
    line-height: 1;
    flex-shrink: 0;
    box-shadow: 0 1px 3px rgba(2, 132, 199, 0.4);
}

.insure-local-brand-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border-radius: 4px;
    background: #173e54;
    color: #ffffff;
    vertical-align: middle;
    margin-right: 5px;
    flex-shrink: 0;
    box-shadow: 0 1px 3px rgba(23, 62, 84, 0.35);
}

.insure-local-dot {
    color: #bb8428;
    font-weight: 900;
    font-size: 1.15em;
    line-height: 1;
    margin-left: 1px;
}

/* Light mode support for Kunjunni Chip & Insure Local */
body.light-mode .kunjunni-chip {
    background: rgba(19, 78, 72, 0.06) !important;
    border: 1.5px solid rgba(19, 78, 72, 0.25) !important;
    color: #134e48 !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05) !important;
}

body.light-mode .kunjunni-chip:hover {
    background: rgba(19, 78, 72, 0.12) !important;
    border-color: #134e48 !important;
    color: #042f2e !important;
}

body.light-mode .kunjunni-chip.active {
    background: #ccfbf1 !important;
    border-color: #0f766e !important;
    color: #115e59 !important;
    box-shadow: 0 2px 6px rgba(15, 118, 110, 0.25) !important;
}

body.light-mode .uplift-plan-chip {
    background: rgba(2, 132, 199, 0.06) !important;
    border: 1.5px solid rgba(2, 132, 199, 0.25) !important;
    color: #0369a1 !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05) !important;
}

body.light-mode .uplift-plan-chip:hover {
    background: rgba(2, 132, 199, 0.12) !important;
    border-color: #0284c7 !important;
    color: #0c4a6e !important;
}

body.light-mode .uplift-plan-chip.active {
    background: #e0f2fe !important;
    border-color: #0284c7 !important;
    color: #0369a1 !important;
    box-shadow: 0 2px 6px rgba(2, 132, 199, 0.25) !important;
}

body.light-mode #module-kunjunni-calc,
body.light-mode #module-uplift-plan,
body.light-mode #module-insure-local,
body.light-mode #module-fema-jacob {
    background: #ffffff !important;
    border-color: #cbd5e1 !important;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.08) !important;
}

body.light-mode #module-kunjunni-calc>div:first-child,
body.light-mode #module-uplift-plan>div:first-child,
body.light-mode #module-insure-local>div:first-child,
body.light-mode #module-fema-jacob>div:first-child {
    background: #f8fafc !important;
    border-bottom: 1px solid #e2e8f0 !important;
}

body.light-mode #module-kunjunni-calc button,
body.light-mode #module-uplift-plan button,
body.light-mode #module-insure-local button,
body.light-mode #module-fema-jacob button {
    background: #ffffff !important;
    border-color: #cbd5e1 !important;
    color: #334155 !important;
}

body.light-mode #module-insure-local .insure-local-title {
    color: #0f172a !important;
}

body.light-mode #module-uplift-plan .uplift-plan-title {
    color: #0284c7 !important;
}

body.light-mode #module-uplift-plan>div:nth-child(2) {
    background: rgba(2, 132, 199, 0.08) !important;
    color: #0369a1 !important;
}

body.light-mode #module-kunjunni-calc .kunjunni-calc-title {
    color: #0d9488 !important;
}

body.light-mode #module-kunjunni-calc>div:nth-child(2) {
    background: rgba(13, 148, 136, 0.08) !important;
    color: #0f766e !important;
}

body.light-mode #module-insure-local>div:nth-child(2) {
    background: rgba(23, 62, 84, 0.08) !important;
    color: #1e293b !important;
}

/* Universal Refusal Banner for External Embedded Modules */
.prompt-refusal-banner {
    background: linear-gradient(90deg, rgba(239, 68, 68, 0.18) 0%, rgba(245, 158, 11, 0.18) 100%) !important;
    border-bottom: 1px solid rgba(239, 68, 68, 0.35) !important;
    padding: 10px 18px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 12px !important;
    font-size: 0.82rem !important;
    color: #fecaca !important;
    transition: all 0.3s ease !important;
}
.prompt-refusal-content {
    display: flex !important;
    align-items: center !important;
    gap: 12px !important;
    flex: 1 !important;
    min-width: 260px !important;
}
.prompt-refusal-icon {
    font-size: 1.3rem !important;
    flex-shrink: 0 !important;
}
.prompt-refusal-text {
    flex: 1 !important;
}
.prompt-refusal-title {
    font-weight: 700 !important;
    color: #f87171 !important;
    margin-bottom: 2px !important;
}
.prompt-refusal-desc {
    font-size: 0.78rem !important;
    color: #cbd5e1 !important;
    opacity: 0.95 !important;
}
.prompt-refusal-desc code {
    background: rgba(0, 0, 0, 0.3) !important;
    padding: 1px 4px !important;
    border-radius: 4px !important;
    font-size: 0.75rem !important;
    color: #f8fafc !important;
}
.prompt-btn-launch {
    display: inline-flex !important;
    align-items: center !important;
    gap: 6px !important;
    padding: 7px 16px !important;
    background: linear-gradient(135deg, #0284c7 0%, #10b981 100%) !important;
    color: #ffffff !important;
    border-radius: 8px !important;
    font-size: 12px !important;
    font-weight: 800 !important;
    text-decoration: none !important;
    border: none !important;
    cursor: pointer !important;
    box-shadow: 0 4px 12px rgba(2, 132, 199, 0.35) !important;
    white-space: nowrap !important;
    flex-shrink: 0 !important;
    transition: transform 0.2s, box-shadow 0.2s !important;
}
.prompt-btn-launch:hover {
    transform: translateY(-1px) !important;
    box-shadow: 0 6px 18px rgba(2, 132, 199, 0.45) !important;
}

/* Light mode for Refusal Banner */
body.light-mode .prompt-refusal-banner {
    background: linear-gradient(90deg, #fef2f2 0%, #fffbeb 100%) !important;
    border-bottom-color: #fca5a5 !important;
    color: #991b1b !important;
}
body.light-mode .prompt-refusal-title {
    color: #b91c1c !important;
}
body.light-mode .prompt-refusal-desc {
    color: #475569 !important;
}
body.light-mode .prompt-refusal-desc code {
    background: rgba(0, 0, 0, 0.06) !important;
    color: #0f172a !important;
}


/* Premium Summary height alignment for desktop */
@media (min-width: 901px) {

    #module-two-wheeler .result-section,
    #module-private-car .right-column.result-section,
    #module-commercial .right-column {
        height: auto !important;
        max-height: calc(100vh - 120px) !important;
        align-self: flex-start !important;
    }
}

/* --- GLOBAL CALCULATOR FOREGROUND TEXT SCALING (115%) --- */
.calculator-grid,
#idv-wizard-modal,
.floating-summary-container {
    font-size: 1.15rem;
}

.calculator-grid h2,
#idv-wizard-modal h2 {
    font-size: 1.4375rem !important;
}

.calculator-grid label,
.calculator-grid .segment-control label,
#idv-wizard-modal label {
    font-size: 1.035rem !important;
}

.calculator-grid select,
.calculator-grid input,
#idv-wizard-modal select,
#idv-wizard-modal input {
    font-size: 1.15rem !important;
}

.calculator-grid .calculate-btn,
.calculator-grid .action-btn,
#idv-wizard-modal button {
    font-size: 1.265rem !important;
}

@media (max-width: 600px) {

    .calculator-grid .calculate-btn,
    .calculator-grid .action-btn {
        font-size: clamp(0.9rem, 4.5vw, 1.1rem) !important;
        padding: 10px 8px !important;
    }
}

.calculator-grid .result-row,
.calculator-grid .total-sub,
.calculator-grid .checkbox-container {
    font-size: 1.0925rem !important;
}

.calculator-grid .sub-item,
.calculator-grid .payout-total {
    font-size: 0.9775rem !important;
}

.calculator-grid .grand-total .result-row.final {
    font-size: 1.725rem !important;
}

.calculator-grid .payout-subheader {
    font-size: 0.805rem !important;
}

.calculator-grid .hint,
.calculator-grid .checkbox-container.disabled:hover::after {
    font-size: 0.8625rem !important;
}

.calculator-grid .info-icon {
    font-size: 0.92rem !important;
}

.calculator-grid .upload-text {
    font-size: 1.035rem !important;
}

.calculator-grid .upload-box small {
    font-size: 0.8625rem !important;
}

/* Switch Toggle Slider Components for Profile Modal */
.switch input:checked+.slider {
    background-color: #2ed573 !important;
    box-shadow: 0 0 10px rgba(46, 213, 115, 0.3);
}

.switch input:focus+.slider {
    box-shadow: 0 0 1px #2ed573;
}

.switch .slider:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: .3s;
    border-radius: 50%;
}

.switch input:checked+.slider:before {
    transform: translateX(20px);
}

.switch input:disabled+.slider {
    opacity: 0.5;
    cursor: not-allowed;
    background-color: #475569;
}

.switch input:disabled+.slider:before {
    background-color: #94a3b8;
}


/* Explicit override to restore high-end Lightbox look for Image Viewer in Light Mode */

body.light-mode #image-viewer-modal {

    background: rgba(0, 0, 0, 0.92) !important;

}

body.light-mode #close-image-viewer {

    color: #ffffff !important;

}




/* ========================================== */
/* Semantic Alert Components for Banner Mods  */
/* ========================================== */
.alert-banner {
    border-radius: 8px;
    padding: 12px 16px;
    font-weight: 600;
    border-width: 1px;
    border-style: solid;
    line-height: 1.5;
    box-sizing: border-box;
    text-align: center;
    display: block;
    width: 100%;
    margin-bottom: 10px;
    /* Ensures depth visual distinctness */
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}

.alert-banner.danger {
    background: var(--alert-danger-bg) !important;
    border-color: var(--alert-danger-border) !important;
    color: var(--alert-danger-text) !important;
}

.alert-banner.info {
    background: var(--alert-info-bg) !important;
    border-color: var(--alert-info-border) !important;
    color: var(--alert-info-text) !important;
}

.alert-banner strong,
.alert-banner b {
    color: inherit;
    font-weight: bold;
}

/* --- NEW PRIVILEGE LOCK VISUAL STATES --- */
/* Force Active+Locked switch states to render in glowing translucent green so users know they possess the privilege */
.switch input:checked:disabled+.slider {
    background-color: #2ed573 !important;
    opacity: 0.8 !important;
    cursor: not-allowed !important;
    box-shadow: 0 0 8px rgba(46, 213, 115, 0.3);
}

.switch input:checked:disabled+.slider:before {
    background-color: #ffffff !important;
    transform: translateX(20px) !important;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* Robust layout guarantees for hint wrappers */
#profile-mentor-toggle-row>div,
#profile-validate-toggle-row>div {
    display: flex !important;
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 2px !important;
    width: auto !important;
}

#profile-mentor-toggle-row small,
#profile-validate-toggle-row small {
    display: block !important;
    visibility: visible !important;
    opacity: 0.9 !important;
    color: #94a3b8 !important;
    /* Slightly lighter gray for absolute legibility in dark mode */
}

#profile-req-mentor-btn,
#profile-req-validate-btn {
    visibility: visible !important;
    opacity: 1 !important;
}

/* CSS Cleaned By Agent */
/* --- THE ULTIMATE PREMIUM SWITCH DESIGN & HIDDEN ENGINE --- */
/* ========================================================= */
.switch {
    position: relative !important;
    display: inline-block !important;
    width: 40px !important;
    height: 22px !important;
    flex-shrink: 0 !important;
    vertical-align: middle !important;
}

/* 100% bulletproof visually hidden CSS to suppress standard system checkboxes completely */
.switch input {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
    opacity: 0 !important;
    pointer-events: none !important;
}

/* Professional Dark-slate Track */
.switch .slider {
    position: absolute !important;
    cursor: pointer !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    background-color: #334155 !important;
    transition: background-color 0.3s ease, box-shadow 0.3s ease !important;
    border-radius: 34px !important;
    z-index: 1 !important;
}

/* Toggle Knob */
.switch .slider:before {
    position: absolute !important;
    content: "" !important;
    height: 16px !important;
    width: 16px !important;
    left: 3px !important;
    bottom: 3px !important;
    background-color: #ffffff !important;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
    border-radius: 50% !important;
    z-index: 3 !important;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3) !important;
}

/* Checked Active State: Vibrant Professional Emerald Green */
.switch input:checked+.slider {
    background-color: #10b981 !important;
    box-shadow: 0 0 8px rgba(16, 185, 129, 0.4) !important;
}

.switch input:checked+.slider:before {
    transform: translateX(18px) !important;
}

/* Disabled / Locked States */
.switch input:disabled+.slider {
    cursor: not-allowed !important;
    opacity: 0.4 !important;
}

/* Active AND Disabled: Maximum Legibility Emerald Locked */
.switch input:checked:disabled+.slider {
    background-color: #10b981 !important;
    opacity: 0.85 !important;
    /* Minimal fade to ensure full, clear active visual */
    box-shadow: 0 0 10px rgba(16, 185, 129, 0.4) !important;
    cursor: not-allowed !important;
}

.switch input:checked:disabled+.slider:before {
    transform: translateX(18px) !important;
    background-color: #ffffff !important;
}

/* Ensure absolute visibility on the sub-text labels */
#profile-mentor-toggle-row small,
#profile-validate-toggle-row small {
    font-weight: 600 !important;
    font-size: 0.7rem !important;
    margin-top: 2px !important;
}

/* Custom spacing and centering locks for restored center-aligned toggle rows */
#profile-mentor-toggle-row,
#profile-validate-toggle-row {
    display: block !important;
    text-align: center !important;
    clear: both !important;
}

#profile-mentor-toggle-row>div,
#profile-validate-toggle-row>div {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    margin: 4px auto !important;
}

/* --- ENHANCED ACCESSIBILITY & USABILITY OVERRIDES --- */

/* Ensure checkboxes inside .checkbox-container remain hidden so custom .checkmark handles the checkmark cleanly */
.checkbox-container input[type="checkbox"],
.checkbox-container input {
    position: absolute !important;
    opacity: 0 !important;
    cursor: pointer !important;
    height: 0 !important;
    width: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    border: none !important;
    pointer-events: none !important;
    appearance: none !important;
    -webkit-appearance: none !important;
}

.checkbox-container input[type="checkbox"]::after,
.checkbox-container input::after {
    content: none !important;
    display: none !important;
}

/* Custom Checkbox Styling for standalone checkboxes (outside .checkbox-container) */
input[type="checkbox"]:not(.checkbox-container input) {
    cursor: pointer;
    position: relative;
    width: 18px;
    height: 18px;
    -webkit-appearance: none;
    appearance: none;
    background: rgba(0, 0, 0, 0.25);
    border: 2px solid var(--accent-blue);
    border-radius: 4px;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    vertical-align: middle;
}

input[type="checkbox"]:not(.checkbox-container input):checked {
    background: var(--accent-blue);
    border-color: var(--accent-blue);
}

input[type="checkbox"]:not(.checkbox-container input):checked::after {
    content: '\2713';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #ffffff;
    font-size: 13px;
    font-weight: 900;
    line-height: 1;
}

input[type="checkbox"]:not(.checkbox-container input):disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

body.light-mode input[type="checkbox"]:not(.checkbox-container input) {
    background: rgba(255, 255, 255, 0.8);
    border: 2px solid #0284c7;
    /* Darker blue for light mode */
}

body.light-mode input[type="checkbox"]:not(.checkbox-container input):checked {
    background: #0284c7;
    border-color: #0284c7;
}

body.light-mode input[type="checkbox"]:not(.checkbox-container input):checked::after {
    color: #ffffff;
}

/* Easy Mode Toggle Checkbox Styling */
#lite-mode-checkbox {
    width: 16px !important;
    height: 16px !important;
    min-width: 16px !important;
    min-height: 16px !important;
    border-radius: 4px !important;
}

#lite-mode-checkbox:checked {
    background: #f59e0b !important;
    border-color: #f59e0b !important;
}

#lite-mode-checkbox:checked::after {
    content: '\2713' !important;
    position: absolute !important;
    top: 50% !important;
    left: 50% !important;
    transform: translate(-50%, -50%) !important;
    color: #0f172a !important;
    font-size: 12px !important;
    font-weight: 900 !important;
    line-height: 1 !important;
}

body.light-mode #lite-mode-checkbox:checked {
    background: #d97706 !important;
    border-color: #d97706 !important;
}

body.light-mode #lite-mode-checkbox:checked::after {
    color: #ffffff !important;
}

/* Pulse/Glow for mandatory status */
.schema-cov-mand:checked,
.cov-active-chk:checked {
    box-shadow: 0 0 12px rgba(var(--accent-blue-rgb), 0.6);
}

body.light-mode .schema-cov-mand:checked,
body.light-mode .cov-active-chk:checked {
    box-shadow: 0 0 8px rgba(2, 132, 199, 0.4);
}

/* Breathing animation for highlighted 'i' buttons */
@keyframes breatheTip {
    0% {
        transform: scale(1);
        box-shadow: 0 0 0px rgba(var(--accent-blue-rgb), 0);
    }

    50% {
        transform: scale(1.25);
        box-shadow: 0 0 15px rgba(var(--accent-blue-rgb), 0.6);
    }

    100% {
        transform: scale(1);
        box-shadow: 0 0 0px rgba(var(--accent-blue-rgb), 0);
    }
}

.tip-breathe {
    animation: breatheTip 2s infinite ease-in-out;
    background: var(--accent-blue) !important;
    color: #0f172a !important;
    border-color: #fff !important;
}

/* Flash highlight for the info display area */
@keyframes infoFlash {
    0% {
        background: rgba(var(--accent-blue-rgb), 0.2);
        border-color: var(--accent-blue);
    }

    100% {
        background: rgba(0, 0, 0, 0.1);
        border-color: rgba(255, 255, 255, 0.05);
    }
}

.info-flash-active {
    animation: infoFlash 0.8s ease-out;
}

/* Configuration Guide Panel Theme Styles */
.config-guide-panel {
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.2);
}

.config-guide-warn-row {
    color: #f87171;
    border-bottom: 1px solid rgba(239, 68, 68, 0.15);
}

.config-guide-item-info {
    color: #94a3b8;
    background: rgba(59, 130, 246, 0.05);
    border: 1px solid rgba(59, 130, 246, 0.1);
}

.config-guide-item-info .title {
    color: var(--accent-blue);
}

.config-guide-item-info .highlight {
    color: #fff;
}

.config-guide-item-custom {
    color: #cbd5e1;
    background: rgba(168, 85, 247, 0.05);
    border: 1px solid rgba(168, 85, 247, 0.1);
}

.config-guide-item-custom .title {
    color: #a855f7;
}

.config-guide-item-custom .highlight {
    color: #fff;
}

/* Light Mode Overrides */
body.light-mode .config-guide-panel {
    background: #f1f5f9;
    border: 1px solid rgba(0, 0, 0, 0.1);
    box-shadow: none;
}

body.light-mode .config-guide-warn-row {
    color: #dc2626;
    border-bottom: 1px solid rgba(220, 38, 38, 0.1);
}

body.light-mode .config-guide-item-info {
    color: #475569;
    background: #f0f9ff;
    border: 1px solid #bae6fd;
}

body.light-mode .config-guide-item-info .title {
    color: #0369a1;
}

body.light-mode .config-guide-item-info .highlight {
    color: #0f172a;
}

body.light-mode .config-guide-item-custom {
    color: #475569;
    background: #faf5ff;
    border: 1px solid #e9d5ff;
}

body.light-mode .config-guide-item-custom .title {
    color: #7e22ce;
}

body.light-mode .config-guide-item-custom .highlight {
    color: #0f172a;
}


}

/* Status Badges */
.status-badge {
    font-size: 0.65rem;
    padding: 2px 8px;
    border-radius: 10px;
    border: 1px solid;
    font-weight: 800;
    letter-spacing: 0.5px;
    display: inline-flex;
    align-items: center;
}

/* Semantic UI Tint Classes */
.tint-btn {
    border: 1px solid transparent;
    padding: 3px 8px;
    border-radius: 4px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.tint-btn:hover {
    filter: brightness(1.2);
    transform: translateY(-1px);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

.tint-green {
    color: #4ade80 !important;
    background: rgba(74, 222, 128, 0.15) !important;
    border-color: rgba(74, 222, 128, 0.3) !important;
}

.tint-red {
    color: #f87171 !important;
    background: rgba(239, 68, 68, 0.15) !important;
    border-color: rgba(239, 68, 68, 0.3) !important;
}

.tint-blue {
    color: #60a5fa !important;
    background: rgba(59, 130, 246, 0.15) !important;
    border-color: rgba(59, 130, 246, 0.3) !important;
}

.tint-purple {
    color: #a855f7 !important;
    background: rgba(168, 85, 247, 0.15) !important;
    border-color: rgba(168, 85, 247, 0.3) !important;
}

.tint-amber {
    color: #fbbf24 !important;
    background: rgba(251, 191, 36, 0.15) !important;
    border-color: rgba(251, 191, 36, 0.3) !important;
}

body.light-mode .tint-green {
    color: #065f46 !important;
    background: #f0fdf4 !important;
    border-color: #bbf7d0 !important;
}

body.light-mode .tint-red {
    color: #991b1b !important;
    background: #fef2f2 !important;
    border-color: #fecaca !important;
}

body.light-mode .tint-blue {
    color: #075985 !important;
    background: #f0f9ff !important;
    border-color: #bae6fd !important;
}

body.light-mode .tint-purple {
    color: #6b21a8 !important;
    background: #faf5ff !important;
    border-color: #e9d5ff !important;
}

body.light-mode .tint-amber {
    color: #92400e !important;
    background: #fffbeb !important;
    border-color: #fef3c7 !important;
}

/* Greyish highlights for small buttons in light mode */
body.light-mode .tint-btn {
    background: #f1f5f9 !important;
    color: #475569 !important;
    border-color: #e2e8f0 !important;
}

body.light-mode .tint-btn:hover {
    background: #e2e8f0 !important;
    color: #0f172a !important;
}

/* Modal Title Legibility */
.modal-section-title {
    color: var(--accent-blue) !important;
    font-weight: 800 !important;
    text-shadow: none !important;
}

.modal-section-title-alt {
    color: #fbbf24 !important;
    font-weight: 800 !important;
    text-shadow: none !important;
}

body.light-mode .modal-section-title {
    color: #0369a1 !important;
}

body.light-mode .modal-section-title-alt {
    color: #92400e !important;
}

/* Legibility fixes for Modal */
body.light-mode .modal-label-bold {
    color: #0f172a !important;
    font-weight: 800 !important;
}

body.light-mode .coverage-grid-row span {
    color: #1e293b !important;
}

body.light-mode .cov-desc-editor {
    color: #0f172a !important;
    background: #ffffff !important;
    border: 1px solid #cbd5e1 !important;
}

/* Input contrast in light mode */
body.light-mode input.cov-own-rate,
body.light-mode input.cov-advised-rate,
body.light-mode input.cov-mandated-rate,
body.light-mode input.cov-si-input {
    background: #ffffff !important;
    color: #0f172a !important;
    border: 1px solid #cbd5e1 !important;
}

body.light-mode input.cov-advised-rate:disabled,
body.light-mode input.cov-mandated-rate:disabled {
    background: #f1f5f9 !important;
    color: #64748b !important;
}

/* Fixed Rule Highlighting in Schema Editor */
.fixed-row-highlight {
    background: rgba(var(--accent-blue-rgb), 0.1) !important;
    border: 1px dashed rgba(var(--accent-blue-rgb), 0.4) !important;
}

body.light-mode .fixed-row-highlight {
    background: #ecfeff !important;
    border: 1px dashed #22d3ee !important;
}

.fixed-row-highlight input {
    color: var(--accent-blue) !important;
    font-weight: 800 !important;
}

body.light-mode .fixed-row-highlight input {
    color: #0891b2 !important;
}

/* Specific overrides to prevent wildcard [class*="modal"] selector from forcing backgrounds on labels and table headers in light-mode */
body.light-mode .coverage-grid-header .modal-label-bold,
body.light-mode .coverage-grid-header div,
body.light-mode th.modal-label-bold {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
}

/* Fix glowy colors in light mode */
body.light-mode * {
    text-shadow: none !important;
}

body.light-mode .text-success,
body.light-mode [style*='color: #2ecc71'],
body.light-mode [style*='color:#2ecc71'],
body.light-mode [style*='color: #00ff88'],
body.light-mode [style*='color:#00ff88'] {
    color: #15803d !important;
    /* Darker green */
}

body.light-mode .text-warning,
body.light-mode [style*='color: #f1c40f'],
body.light-mode [style*='color:#f1c40f'],
body.light-mode [style*='color: #f39c12'],
body.light-mode [style*='color:#f39c12'],
body.light-mode [style*='color: #ffd700'],
body.light-mode [style*='color:#ffd700'] {
    color: #b45309 !important;
    /* Darker amber/orange for readability */
}

body.light-mode .info-btn,
body.light-mode .fas.fa-info-circle {
    color: #0369a1 !important;
    /* Legible blue for i buttons in light mode */
}

/* Modals i-button readability for Dark Mode */
body:not(.light-mode) .swal2-html-container [style*='color:#2ecc71'],
body:not(.light-mode) .swal2-html-container [style*='color: #2ecc71'],
body:not(.light-mode) #modal-desc [style*='color:#2ecc71'],
body:not(.light-mode) #modal-desc [style*='color: #2ecc71'] {
    color: #4ade80 !important;
    /* Brighter green for dark mode contrast */
}

body:not(.light-mode) .swal2-html-container [style*='color:#f1c40f'],
body:not(.light-mode) .swal2-html-container [style*='color: #f1c40f'],
body:not(.light-mode) #modal-desc [style*='color:#f1c40f'],
body:not(.light-mode) #modal-desc [style*='color: #f1c40f'] {
    color: #fcd34d !important;
    /* Brighter yellow for dark mode contrast */
}

body:not(.light-mode) .swal2-html-container [style*='color:#ff7675'],
body:not(.light-mode) .swal2-html-container [style*='color: #ff7675'],
body:not(.light-mode) #modal-desc [style*='color:#ff7675'],
body:not(.light-mode) #modal-desc [style*='color: #ff7675'] {
    color: #fca5a5 !important;
    /* Brighter red */
}

/* ============================================================
   MOBILE BOTTOM RIBBON SIDEBAR (ADDED FOR v7.4)
   ============================================================ */
@media (max-width: 768px) {
    #gemini-assistant-fab {
        display: none !important;
    }

    .sidebar {
        top: auto !important;
        bottom: 0 !important;
        left: 0 !important;
        width: 100% !important;
        height: auto !important;
        max-height: 60px !important;
        flex-direction: row !important;
        border-right: none !important;
        border-top: 1px solid var(--glass-border) !important;
        transform: none !important;
        padding: 4px !important;
        border-radius: 12px 12px 0 0 !important;
        z-index: 10001 !important;
        background: rgba(15, 23, 42, 0.98) !important;
        box-shadow: 0 -4px 15px rgba(0, 0, 0, 0.4) !important;
        -ms-overflow-style: none;
        scrollbar-width: none;
        overflow-x: auto !important;
        overflow-y: hidden !important;
    }

    .sidebar.hidden {
        display: flex !important;
    }

    .sidebar::-webkit-scrollbar {
        display: none;
    }

    #sidebar-toggle {
        display: none !important;
    }

    .sidebar-header {
        display: none !important;
    }

    .sidebar-menu {
        display: flex !important;
        flex-direction: row !important;
        padding: 0 !important;
        margin: 0 !important;
        width: 100% !important;
        overflow-x: visible !important;
        align-items: center !important;
        gap: 2px !important;
        -ms-overflow-style: none;
        scrollbar-width: none;
    }

    .sidebar-menu::-webkit-scrollbar {
        display: none;
    }

    .sidebar-menu li {
        margin-bottom: 0 !important;
        padding: 0 !important;
        flex-shrink: 0 !important;
        display: flex !important;
        flex-direction: row !important;
        align-items: center !important;
        gap: 2px !important;
    }

    .sidebar-menu .submenu {
        display: flex !important;
        flex-direction: row !important;
        position: static !important;
        padding: 0 !important;
        margin: 0 !important;
        gap: 2px !important;
        background: transparent !important;
        border: none !important;
        box-shadow: none !important;
    }

    .sidebar-menu .submenu.hidden {
        display: none !important;
    }

    .sidebar-menu a {
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
        justify-content: center !important;
        padding: 4px 6px !important;
        font-size: 0.6rem !important;
        gap: 2px !important;
        border-radius: 8px !important;
        min-width: 50px !important;
        text-align: center !important;
        line-height: 1.1 !important;
        white-space: normal !important;
    }

    .sidebar-menu a i,
    .sidebar-menu a span.material-icons,
    .sidebar-menu a span.material-symbols-outlined,
    .sidebar-menu a .icon,
    .sidebar-menu a span:first-child {
        font-size: 1.1rem !important;
        margin: 0 !important;
        display: block !important;
    }

    .sidebar-section-title {
        display: none !important;
    }

    .separator {
        display: none !important;
    }

    .calc-tile-grid {
        display: flex !important;
        flex-direction: row !important;
        padding: 0 !important;
        margin: 0 !important;
        gap: 2px !important;
    }

    .calc-tile {
        flex-direction: column !important;
        padding: 4px 6px !important;
        font-size: 0.6rem !important;
        gap: 2px !important;
        min-width: 50px !important;
        justify-content: center !important;
        align-items: center !important;
        margin: 0 !important;
        line-height: 1.1 !important;
        border-radius: 8px !important;
    }

    .calc-tile span:first-child {
        font-size: 1.1rem !important;
    }

    /* Provide bottom padding so main content is not hidden behind ribbon */
    body {
        padding-bottom: 70px !important;
    }

    /* Compact Verification Banner for Mobile Screens */
    #verification-banner-wrapper,
    #lite-mode-summary-banner-wrapper {
        margin-bottom: 8px !important;
    }

    #verification-banner {
        padding: 6px 12px !important;
        margin-bottom: 0 !important;
        gap: 10px !important;
        justify-content: space-between !important;
        flex-direction: row !important;
        border-radius: 0 0 8px 8px !important;
    }

    #verification-banner>span:first-child {
        display: none !important;
        /* Hide warning icon on mobile to save horizontal space */
    }

    #verification-banner-text {
        font-size: 0.75rem !important;
        line-height: 1.2 !important;
        text-align: left !important;
        flex: 1 !important;
    }

    #verification-banner button {
        padding: 5px 12px !important;
        font-size: 0.75rem !important;
        white-space: nowrap !important;
        flex-shrink: 0 !important;
    }

    .portfolio-nav,
    .sub-portfolio-nav {
        gap: 4px !important;
        margin-bottom: 0.4rem !important;
        padding-bottom: 4px !important;
        padding-top: 2px !important;
        border-radius: 10px !important;
    }

    .nav-tab {
        padding: 5px 10px !important;
        font-size: 0.8rem !important;
    }

    .sub-tab {
        padding: 2px 6px !important;
        font-size: 0.65rem !important;
        line-height: 1 !important;
        height: auto !important;
    }

    .lite-mode-toggle {
        padding: 2px 5px !important;
        font-size: 0.65rem !important;
        margin-left: 2px !important;
    }

    /* Compact Learn/Calculate/chatCulate toggle on mobile */
    .view-toggle-wrapper {
        margin-bottom: 0.6rem !important;
    }

    .view-toggle {
        padding: 3px !important;
        gap: 2px !important;
    }

    .toggle-btn {
        padding: 5px 12px !important;
        font-size: 0.78rem !important;
        border-radius: 18px !important;
    }

    /* Reduce top padding inside input-section (Vehicle Details) on mobile */
    .input-section.glass-panel {
        padding-top: 4px !important;
    }

    .view-toggle-wrapper+* .input-section.glass-panel,
    #view-calculator .input-section.glass-panel {
        padding-top: 4px !important;
    }
}

/* â”€â”€â”€ Mobile Collapsible Banners â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€ */
.mobile-collapsible-banner {
    margin-bottom: 8px;
    border-radius: 8px;
    overflow: hidden;
}

/* Toggle header â€” hidden on desktop, shown on mobile */
.mobile-banner-toggle {
    display: none;
}

/* Banner body always visible on desktop */
.mobile-banner-body {
    display: flex !important;
}

@media (max-width: 768px) {
    .mobile-banner-toggle {
        display: flex;
        align-items: center;
        gap: 8px;
        width: 100%;
        background: rgba(239, 68, 68, 0.15);
        color: #fca5a5;
        border: 1px solid rgba(239, 68, 68, 0.3);
        padding: 7px 14px;
        border-radius: 8px;
        cursor: pointer;
        font-size: 0.8rem;
        font-weight: 700;
        text-align: left;
        transition: background 0.2s, color 0.2s, border-color 0.2s;
        letter-spacing: 0.2px;
    }

    body.light-mode .mobile-banner-toggle {
        background: #fef2f2;
        color: #991b1b;
        border-color: #fecaca;
    }

    .mobile-banner-toggle--green {
        background: rgba(16, 185, 129, 0.15);
        color: #6ee7b7;
        border-color: rgba(16, 185, 129, 0.3);
    }

    body.light-mode .mobile-banner-toggle--green {
        background: #f0fdf4;
        color: #065f46;
        border-color: #bbf7d0;
    }

    .mobile-banner-toggle-icon {
        font-size: 1rem;
        flex-shrink: 0;
    }

    .mobile-banner-toggle-label {
        flex: 1;
    }

    .mobile-banner-chevron {
        font-size: 0.65rem;
        opacity: 0.8;
        transition: transform 0.25s;
        flex-shrink: 0;
    }

    .mobile-collapsible-banner[data-open="true"] .mobile-banner-chevron {
        transform: rotate(180deg);
    }

    .mobile-collapsible-banner[data-open="true"] .mobile-banner-toggle {
        border-radius: 8px 8px 0 0;
    }

    /* Collapsed by default: hide body */
    .mobile-banner-body {
        display: none !important;
        transition: max-height 0.25s ease;
    }

    /* Expanded state */
    .mobile-collapsible-banner[data-open="true"] .mobile-banner-body {
        display: flex !important;
    }
}

/* --- Floating AI FAB & Modals Interaction --- */
.modal:not(.hidden)~#gemini-assistant-fab,
body:has(.modal:not(.hidden)) #gemini-assistant-fab {
    display: none !important;
}

.lite-mode-hidden {
    display: none !important;
}

body.lite-mode-active .lite-mode-hidden {
    display: none !important;
}

.show-mobile-tab-text {
    display: none;
}

@media (max-width: 600px) {
    .hide-mobile-tab-text {
        display: none;
    }

    .show-mobile-tab-text {
        display: inline;
    }

    .sub-tab {
        padding: 6px 12px !important;
        font-size: 0.85rem !important;
    }

    .lite-mode-toggle {
        padding: 4px 8px !important;
        font-size: 0.80rem !important;
    }

    .kunjunni-chip {
        padding: 4px 8px !important;
        font-size: 0.80rem !important;
    }

    .uplift-plan-chip {
        padding: 4px 8px !important;
        font-size: 0.80rem !important;
    }
}

/* Force elements into symbol-only layout on mobile/tablets to prevent wrapping */
@media (max-width: 900px) {

    .hide-on-mobile,
    #user-name,
    #header-verified-badge {
        display: none !important;
    }

    #header-quick-links {
        display: flex !important;
        flex-direction: row !important;
        flex-wrap: nowrap !important;
    }
}

.header-left {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    align-items: center !important;
    gap: 10px !important;
    flex-shrink: 0 !important;
}




/* --- MOBILE TILE LAYOUT FOR SQMS TABLE --- */
@media (max-width: 768px) {
    .desktop-text {
        display: none !important;
    }

    .mobile-text {
        display: inline !important;
    }

    #sqms-clearance-status {
        padding: 4px 10px !important;
        font-size: 0.75rem !important;
    }

    #next-clearance-time {
        width: 110px !important;
        font-size: 0.85rem !important;
    }

    .sqms-table,
    .sqms-table tbody {
        display: block !important;
        width: 100% !important;
    }

    .sqms-table thead {
        display: none !important;
    }

    .sqms-row {
        display: grid !important;
        grid-template-columns: auto 1fr !important;
        grid-template-areas:
            "status actions"
            "polino date"
            "agent rc"
            "veh veh"
            "offrem offrem" !important;
        gap: 2px !important;
        margin-bottom: 8px !important;
        border: 1px solid rgba(255, 255, 255, 0.1) !important;
        border-radius: 8px !important;
        padding: 8px !important;
        background: rgba(0, 0, 0, 0.15) !important;
    }

    .sqms-row td {
        display: block !important;
        padding: 0 !important;
        border: none !important;
        text-align: left !important;
        white-space: normal !important;
        width: auto !important;
        min-width: 0 !important;
        line-height: 1.15 !important;
    }

    .sqms-table .hide-on-mobile {
        display: block !important;
    }

    /* Assign grid areas */
    .sqms-row td:nth-child(1) {
        grid-area: status;
        display: flex !important;
        justify-content: flex-start;
        align-items: center;
    }

    .sqms-row td:nth-child(2) {
        grid-area: rc;
        display: flex !important;
        justify-content: flex-end;
        align-items: center;
    }

    .sqms-row td:nth-child(3) {
        grid-area: date;
        font-size: 0.75rem !important;
        color: #94a3b8 !important;
        text-align: right !important;
    }

    .sqms-row td:nth-child(4) {
        display: none !important;
    }

    /* Token type hidden */
    .sqms-row td:nth-child(5) {
        grid-area: agent;
        text-align: left !important;
        font-size: 0.8rem !important;
        color: #94a3b8 !important;
    }

    .sqms-row td:nth-child(6) {
        grid-area: polino;
        font-size: 0.95rem !important;
        margin-bottom: 2px;
        white-space: nowrap !important;
    }

    .sqms-row td:nth-child(7) {
        grid-area: veh;
        font-size: 0.9rem !important;
        color: #e2e8f0 !important;
        margin-top: 4px !important;
        padding-top: 4px !important;
        border-top: 1px dashed rgba(255, 255, 255, 0.1) !important;
        white-space: normal !important;
        overflow: visible !important;
    }

    .sqms-row td:nth-child(8) {
        grid-area: offrem;
        font-size: 0.9rem !important;
        padding-top: 2px !important;
        margin-top: 2px !important;
        border-top: 1px dashed rgba(255, 255, 255, 0.1) !important;
        white-space: normal !important;
        overflow: visible !important;
    }

    .sqms-row td:nth-child(9) {
        display: none !important;
    }

    /* Hidden arrival time to save space */
    .sqms-row td:nth-child(10) {
        grid-area: actions;
        display: flex !important;
        justify-content: flex-end;
        align-items: center;
        margin-top: 0 !important;
        margin-bottom: 4px !important;
    }

    /* Light mode fixes for tile */
    body.light-mode .sqms-row {
        background: #ffffff !important;
        border: 1px solid #cbd5e1 !important;
        box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05) !important;
    }

    body.light-mode .sqms-row td:nth-child(3),
    body.light-mode .sqms-row td:nth-child(5) {
        color: #64748b !important;
    }

    body.light-mode .sqms-row td:nth-child(7) {
        color: #334155 !important;
    }

    body.light-mode .sqms-row td:nth-child(8) {
        border-top: 1px dashed #cbd5e1 !important;
    }
}

/* SQMS Compact Single-Line Smilies / Emoji Bars */
.sqms-smilies-bar {
    display: inline-flex !important;
    flex-wrap: nowrap !important;
    align-items: center !important;
    gap: 2px !important;
    font-size: 0.78rem !important;
    line-height: 1 !important;
    user-select: none !important;
    max-width: 100% !important;
    overflow-x: auto !important;
    scrollbar-width: none !important;
}

.sqms-smilies-bar::-webkit-scrollbar {
    display: none !important;
}

.sqms-smilies-bar span {
    cursor: pointer !important;
    display: inline-block !important;
    transition: transform 0.12s ease !important;
    flex-shrink: 0 !important;
    line-height: 1 !important;
}

.sqms-smilies-bar span:hover {
    transform: scale(1.22) !important;
}

.sqms-chat-smilies-bar {
    display: flex !important;
    flex-wrap: nowrap !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 4px !important;
    padding: 3px 8px !important;
    border-top: 1px solid rgba(255, 255, 255, 0.08) !important;
    background: rgba(0, 0, 0, 0.18) !important;
    font-size: 0.82rem !important;
    line-height: 1 !important;
    overflow-x: auto !important;
    scrollbar-width: none !important;
}

.sqms-chat-smilies-bar::-webkit-scrollbar {
    display: none !important;
}

.sqms-chat-smilies-bar span {
    cursor: pointer !important;
    user-select: none !important;
    transition: transform 0.12s ease !important;
    flex-shrink: 0 !important;
    line-height: 1 !important;
}

.sqms-chat-smilies-bar span:hover {
    transform: scale(1.22) !important;
}

@media (max-width: 768px) {
    .sqms-smilies-bar {
        display: none !important;
    }

    /* Mobile Status Group Header Cards */
    .group-header {
        display: block !important;
        width: 100% !important;
        margin: 12px 0 6px 0 !important;
        clear: both !important;
    }

    .group-header td {
        display: flex !important;
        align-items: center !important;
        width: 100% !important;
        padding: 8px 12px !important;
        border-radius: 8px !important;
        background: rgba(30, 41, 59, 0.95) !important;
        border: 1px solid rgba(255, 255, 255, 0.12) !important;
        box-sizing: border-box !important;
        font-size: 0.85rem !important;
        color: #fff !important;
        font-weight: bold !important;
    }

    body.light-mode .group-header td,
    .sqms-light-mode .group-header td {
        background: #e2e8f0 !important;
        border: 1px solid #cbd5e1 !important;
        color: #1e293b !important;
    }

    #sqms-edit-agent-remark,
    #sqms-edit-office-remark,
    #new-req-remark,
    #lite-req-remark {
        min-height: 45px !important;
        font-size: 0.95rem !important;
    }

    /* Mobile Responsive New Request Modal */
    #sqms-add-modal .modal-content {
        width: 96vw !important;
        max-width: 96vw !important;
        margin: 2vh auto !important;
        max-height: 94vh !important;
        display: flex !important;
        flex-direction: column !important;
    }

    #sqms-standard-fields {
        grid-template-columns: 1fr !important;
        gap: 10px !important;
    }

    #sqms-add-modal .modal-body {
        padding: 0.8rem 1rem 40px 1rem !important;
        max-height: 75vh !important;
        overflow-y: auto !important;
    }

    .sqms-modal-footer-actions {
        flex-direction: column-reverse !important;
        gap: 10px !important;
        width: 100% !important;
    }

    .sqms-modal-footer-actions>button,
    .sqms-modal-footer-actions>div {
        width: 100% !important;
    }

    .sqms-modal-btn-group {
        flex-direction: column-reverse !important;
        gap: 8px !important;
        width: 100% !important;
    }

    .sqms-modal-footer-actions button {
        width: 100% !important;
        padding: 12px 15px !important;
        font-size: 1rem !important;
        text-align: center !important;
        justify-content: center !important;
        white-space: normal !important;
    }
}

/* Force appropriate color-scheme on date/time inputs so calendar icon and dropdown popup are fully visible and contrasted */
body:not(.light-mode) input[type="date"],
body:not(.light-mode) input[type="time"],
body:not(.light-mode) input[type="datetime-local"] {
    color-scheme: dark !important;
}

body.light-mode input[type="date"],
body.light-mode input[type="time"],
body.light-mode input[type="datetime-local"] {
    color-scheme: light !important;
}

/* --- Embedded External Calculator & Wide Layout Device Compatibility --- */
@media screen and (min-width: 1200px) {
    .container {
        max-width: 95vw !important;
        width: 95vw !important;
        transition: max-width 0.3s ease, width 0.3s ease;
    }

    #module-health-container {
        width: 100% !important;
        max-width: 100% !important;
    }

    #embed-container {
        width: 100% !important;
        padding: 15px 10px !important;
    }

    #health-embed-frame {
        width: 100% !important;
        height: 85vh !important;
        min-height: 750px !important;
    }
}

@media screen and (max-width: 768px) {
    #health-embed-frame {
        width: 100% !important;
        height: 80vh !important;
        min-height: 550px !important;
    }

    #embed-container {
        padding: 10px 5px !important;
    }

    /* Towing Sum Insured Input Box width fix */
    #cv-towing-limit {
        width: 110px !important;
        min-width: 110px !important;
        box-sizing: border-box !important;
    }
}

/* --- Office Connect & Quote Manager Branching Decision Modal --- */
.sqms-branch-overlay {
    position: fixed;
    inset: 0;
    background: rgba(10, 15, 29, 0.85);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    z-index: 25000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 16px;
    opacity: 0;
    transition: opacity 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    box-sizing: border-box;
}

.sqms-branch-overlay.active {
    display: flex !important;
    opacity: 1 !important;
}

.sqms-branch-card {
    background: linear-gradient(145deg, rgba(15, 23, 42, 0.96), rgba(30, 41, 59, 0.94));
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 20px;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.75), 0 0 35px rgba(56, 189, 248, 0.12);
    width: 100%;
    max-width: 960px;
    padding: 26px 28px;
    box-sizing: border-box;
    transform: scale(0.93) translateY(10px);
    transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    position: relative;
    color: #f8fafc;
}

.sqms-branch-overlay.active .sqms-branch-card {
    transform: scale(1) translateY(0);
}

.sqms-branch-close-btn {
    position: absolute;
    top: 14px;
    right: 16px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: #94a3b8;
    font-size: 1.4rem;
    line-height: 1;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.sqms-branch-close-btn:hover {
    background: #ef4444;
    border-color: #dc2626;
    color: #ffffff;
    transform: rotate(90deg) scale(1.05);
}

.sqms-branch-header {
    text-align: left;
    margin-bottom: 20px;
    padding-right: 40px;
}

.sqms-branch-tag {
    display: inline-block;
    font-size: 0.68rem;
    font-weight: 800;
    letter-spacing: 0.8px;
    text-transform: uppercase;
    color: #38bdf8;
    background: rgba(56, 189, 248, 0.15);
    border: 1px solid rgba(56, 189, 248, 0.35);
    padding: 2px 8px;
    border-radius: 12px;
    margin-bottom: 8px;
}

.sqms-branch-title {
    margin: 0 0 6px 0;
    font-size: 1.4rem;
    font-weight: 800;
    color: #f1f5f9;
    letter-spacing: -0.02em;
    background: linear-gradient(135deg, #ffffff 30%, #93c5fd 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.sqms-branch-desc {
    margin: 0;
    font-size: 0.88rem;
    color: #94a3b8;
    line-height: 1.4;
}

.sqms-branch-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 16px;
    margin-bottom: 16px;
}

.sqms-branch-option {
    background: rgba(15, 23, 42, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    padding: 18px 16px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    position: relative;
    overflow: hidden;
    text-align: left;
}

.sqms-branch-option.option-pqms {
    border-color: rgba(45, 212, 191, 0.3);
}

.sqms-branch-option.option-pqms:hover {
    background: linear-gradient(145deg, rgba(20, 184, 166, 0.18), rgba(15, 23, 42, 0.9));
    border-color: #2dd4bf;
    transform: translateY(-4px);
    box-shadow: 0 12px 30px rgba(20, 184, 166, 0.28);
}

.sqms-branch-option.option-sqms {
    border-color: rgba(56, 189, 248, 0.25);
}

.sqms-branch-option.option-sqms:hover {
    background: linear-gradient(145deg, rgba(14, 165, 233, 0.16), rgba(15, 23, 42, 0.9));
    border-color: #38bdf8;
    transform: translateY(-4px);
    box-shadow: 0 12px 30px rgba(14, 165, 233, 0.25);
}

.sqms-branch-option.option-quote-manager {
    border-color: rgba(52, 211, 153, 0.25);
}

.sqms-branch-option.option-quote-manager:hover {
    background: linear-gradient(145deg, rgba(16, 185, 129, 0.16), rgba(15, 23, 42, 0.9));
    border-color: #34d399;
    transform: translateY(-4px);
    box-shadow: 0 12px 30px rgba(16, 185, 129, 0.25);
}

.sqms-option-badge {
    align-self: flex-start;
    font-size: 0.62rem;
    font-weight: 800;
    letter-spacing: 0.5px;
    padding: 2px 7px;
    border-radius: 6px;
    text-transform: uppercase;
    margin-bottom: 10px;
}

.badge-teal {
    background: rgba(20, 184, 166, 0.2);
    border: 1px solid rgba(45, 212, 191, 0.45);
    color: #2dd4bf;
}

.badge-cyan {
    background: rgba(14, 165, 233, 0.2);
    border: 1px solid rgba(56, 189, 248, 0.4);
    color: #38bdf8;
}

.badge-emerald {
    background: rgba(16, 185, 129, 0.2);
    border: 1px solid rgba(52, 211, 153, 0.4);
    color: #34d399;
}

.sqms-option-icon-box {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    margin-bottom: 12px;
}

.icon-teal {
    background: rgba(20, 184, 166, 0.15);
    border: 1px solid rgba(45, 212, 191, 0.3);
}

.icon-cyan {
    background: rgba(56, 189, 248, 0.15);
    border: 1px solid rgba(56, 189, 248, 0.3);
}

.icon-emerald {
    background: rgba(52, 211, 153, 0.15);
    border: 1px solid rgba(52, 211, 153, 0.3);
}

.sqms-option-content {
    flex: 1;
}

.sqms-option-title {
    margin: 0 0 6px 0;
    font-size: 1.05rem;
    font-weight: 700;
    color: #f8fafc;
}

.sqms-option-text {
    margin: 0 0 14px 0;
    font-size: 0.78rem;
    color: #94a3b8;
    line-height: 1.45;
}

.sqms-option-footer {
    margin-top: auto;
    padding-top: 10px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.sqms-option-action {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8rem;
    font-weight: 700;
    transition: gap 0.2s ease;
}

.sqms-branch-option:hover .sqms-option-action {
    gap: 9px;
}

.action-teal {
    color: #2dd4bf;
}

.action-cyan {
    color: #38bdf8;
}

.action-emerald {
    color: #34d399;
}

.sqms-branch-bottom-note {
    text-align: center;
    font-size: 0.72rem;
    color: #64748b;
    padding-top: 6px;
}

/* Light Mode Support */
body.light-mode #sqms-branch-modal .sqms-branch-card {
    background: linear-gradient(145deg, #ffffff, #f8fafc);
    border-color: rgba(0, 0, 0, 0.12);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.18);
    color: #0f172a;
}

body.light-mode #sqms-branch-modal .sqms-branch-title {
    background: linear-gradient(135deg, #0f172a 30%, #2563eb 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

body.light-mode #sqms-branch-modal .sqms-branch-desc {
    color: #64748b;
}

body.light-mode #sqms-branch-modal .sqms-branch-option.option-pqms:hover {
    background: linear-gradient(145deg, rgba(20, 184, 166, 0.12), #ffffff);
    border-color: #0d9488;
}

body.light-mode #sqms-branch-modal .sqms-branch-option {
    background: #ffffff;
    border-color: #e2e8f0;
}

body.light-mode #sqms-branch-modal .sqms-option-title {
    color: #0f172a;
}

body.light-mode #sqms-branch-modal .sqms-option-text {
    color: #64748b;
}

body.light-mode #sqms-branch-modal .sqms-branch-close-btn {
    background: #f1f5f9;
    border-color: #cbd5e1;
    color: #475569;
}

body.light-mode #sqms-branch-modal .sqms-option-footer {
    border-top-color: #f1f5f9;
}

/* Responsive on Mobile */
@media screen and (max-width: 600px) {
    .sqms-branch-card {
        padding: 20px 16px;
        max-height: 92vh;
        overflow-y: auto;
    }

    .sqms-branch-header {
        padding-right: 32px;
        margin-bottom: 14px;
    }

    .sqms-branch-title {
        font-size: 1.15rem;
    }

    .sqms-branch-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .sqms-branch-option {
        padding: 14px 14px;
    }
}


/* ============================================================
   MOBILE UI SIMPLIFICATION (Quick Links, Unified Nav Ribbon,
   Progress Reel Removal & Step-Down Font Scaling - Mobile Only)
   ============================================================ */
.mobile-quick-links-toggle,
.mobile-unified-nav-ribbon {
    display: none;
}

@media (max-width: 768px) {

    /* 1. Step down base font size & calculator typography on mobile */
    html {
        font-size: 14px !important;
    }

    header,
    #main-header {
        margin: -0.5rem -1rem 0.2rem -1rem !important;
        padding: 0.25rem clamp(3px, 1.5vw, 8px) 0.2rem clamp(3px, 1.5vw, 8px) !important;
    }

    #main-header>div:first-child {
        padding: 0.1rem clamp(0.15rem, 1.5vw, 0.4rem) 0.05rem clamp(0.15rem, 1.5vw, 0.4rem) !important;
    }

    .header-branding {
        padding: 0 !important;
        margin: 0 !important;
    }

    header h1,
    #header-title,
    .header-branding h1 {
        font-size: 1.45rem !important;
        line-height: 1.15 !important;
        margin: 0 0 1px 0 !important;
    }

    header p,
    .header-branding p {
        font-size: 0.82rem !important;
        line-height: 1.2 !important;
        margin: 0 !important;
    }

    .mobile-collapsible-banner {
        margin-bottom: 3px !important;
    }

    .module-container,
    #view-calculator,
    .calculator-grid,
    .left-column {
        margin-top: 0 !important;
        padding-top: 0 !important;
    }

    .input-section.glass-panel {
        padding-top: 2px !important;
        margin-top: 0 !important;
    }

    .input-section.glass-panel h2 {
        margin-top: 0 !important;
        margin-bottom: 0.3rem !important;
        padding-bottom: 0.25rem !important;
    }

    .calculator-grid,
    #idv-wizard-modal,
    .floating-summary-container {
        font-size: 0.92rem !important;
    }

    .calculator-grid h2,
    #idv-wizard-modal h2 {
        font-size: 1.12rem !important;
        margin-bottom: 0.45rem !important;
    }

    .calculator-grid h3 {
        font-size: 0.95rem !important;
    }

    .calculator-grid label,
    .calculator-grid .segment-control label,
    #idv-wizard-modal label {
        font-size: 0.86rem !important;
    }

    .calculator-grid select,
    .calculator-grid input,
    #idv-wizard-modal select,
    #idv-wizard-modal input {
        font-size: 0.92rem !important;
    }

    .calculator-grid .calculate-btn,
    .calculator-grid .action-btn,
    #idv-wizard-modal button {
        font-size: 0.92rem !important;
    }

    .calculator-grid .result-row,
    .calculator-grid .total-sub,
    .calculator-grid .checkbox-container {
        font-size: 0.88rem !important;
    }

    .calculator-grid .sub-item,
    .calculator-grid .payout-total {
        font-size: 0.82rem !important;
    }

    .calculator-grid .grand-total .result-row.final {
        font-size: 1.3rem !important;
    }

    .calculator-grid .payout-subheader {
        font-size: 0.7rem !important;
    }

    .calculator-grid .hint,
    .calculator-grid .checkbox-container.disabled:hover::after {
        font-size: 0.72rem !important;
    }

    .calculator-grid .info-icon {
        font-size: 0.78rem !important;
    }

    .calculator-grid .upload-text {
        font-size: 0.86rem !important;
    }

    .calculator-grid .upload-box small {
        font-size: 0.72rem !important;
    }

    /* 2. Collapse 4 Quick Links by default on mobile, expandable sidewise */
    #header-quick-links {
        padding: 3px 8px !important;
        height: 30px !important;
        gap: 5px !important;
        transition: all 0.2s ease !important;
    }

    #header-quick-links .mobile-quick-links-toggle {
        display: inline-flex !important;
        align-items: center;
        justify-content: center;
        gap: 3px;
        background: none;
        border: none;
        color: var(--header-text);
        cursor: pointer;
        font-size: 0.82rem;
        font-weight: 700;
        padding: 2px 3px;
        line-height: 1;
    }

    #header-quick-links:not(.expanded) .header-quick-link {
        display: none !important;
    }

    #header-quick-links.expanded {
        background: var(--glass-bg, #1e293b) !important;
        border-color: rgba(56, 189, 248, 0.4) !important;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35) !important;
        z-index: 10010 !important;
    }

    #header-quick-links.expanded .header-quick-link {
        display: inline-flex !important;
        font-size: 0.98rem !important;
    }

    #header-quick-links.expanded .mobile-quick-links-toggle {
        order: 10;
        padding-left: 4px;
        border-left: 1px solid var(--glass-border, rgba(255, 255, 255, 0.15));
    }

    #header-quick-links.expanded .mobile-quick-links-toggle .qlinks-toggle-icon {
        display: none !important;
    }

    /* 3. Single Unified Navigation Ribbon for Portfolio -> Sub-Portfolio -> View Toggle */
    .mobile-unified-nav-ribbon {
        display: flex !important;
        align-items: center;
        justify-content: space-between;
        width: 100%;
        padding: 2px 8px;
        min-height: 24px;
        margin-top: 0;
        margin-bottom: 3px;
        border-radius: 8px;
        background: rgba(30, 41, 59, 0.88);
        border: 1px solid rgba(56, 189, 248, 0.32);
        cursor: pointer;
        user-select: none;
        box-sizing: border-box;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
        transition: all 0.2s ease;
    }

    body.light-mode .mobile-unified-nav-ribbon {
        background: #ffffff !important;
        border: 1px solid #cbd5e1 !important;
        box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06) !important;
    }

    body.mobile-nav-ribbon-hidden .mobile-unified-nav-ribbon {
        display: none !important;
    }

    .mobile-unified-nav-path {
        display: flex;
        align-items: center;
        gap: 3px;
        font-size: 0.72rem;
        font-weight: 700;
        color: var(--text-primary);
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .mobile-unified-nav-path .nav-path-arrow {
        color: #64748b;
        font-weight: 600;
        font-size: 0.64rem;
        margin: 0 1px;
    }

    .mobile-unified-nav-path .nav-path-segment.active-seg {
        color: #38bdf8;
        background: rgba(56, 189, 248, 0.14);
        padding: 1px 6px;
        font-size: 0.7rem;
        border-radius: 10px;
        border: 1px solid rgba(56, 189, 248, 0.35);
    }

    body.light-mode .mobile-unified-nav-path .nav-path-segment.active-seg {
        color: #0284c7;
        background: #e0f2fe;
        border-color: #7dd3fc;
    }

    .mobile-unified-nav-action {
        display: inline-flex;
        align-items: center;
        gap: 3px;
        font-size: 0.68rem;
        font-weight: 700;
        color: #38bdf8;
        background: rgba(56, 189, 248, 0.1);
        border: 1px solid rgba(56, 189, 248, 0.28);
        padding: 1px 7px;
        border-radius: 10px;
        flex-shrink: 0;
    }

    body.light-mode .mobile-unified-nav-action {
        color: #0284c7;
        background: #f0f9ff;
        border-color: #bae6fd;
    }

    .mobile-unified-nav-chevron {
        display: inline-block;
        font-size: 0.78rem;
        line-height: 1;
        transition: transform 0.2s ease;
        transform: translateY(-1px);
    }

    body.mobile-nav-ribbons-expanded .mobile-unified-nav-chevron {
        transform: rotate(180deg) translateY(-2px);
    }

    /* Collapse Portfolio, Sub-Portfolio & [Learn, Calculate, chatCulate] ribbons by default on mobile */
    body:not(.mobile-nav-ribbons-expanded) .portfolio-nav-wrapper,
    body:not(.mobile-nav-ribbons-expanded) .portfolio-nav,
    body:not(.mobile-nav-ribbons-expanded) .sub-portfolio-nav-wrapper,
    body:not(.mobile-nav-ribbons-expanded) .sub-portfolio-nav,
    body:not(.mobile-nav-ribbons-expanded) .view-toggle-wrapper,
    body:not(.mobile-nav-ribbons-expanded) .private-car-nav {
        display: none !important;
    }

    /* 4. Entirely remove Progress Reel on mobile */
    .calc-element-reel-wrapper,
    .calc-element-reel {
        display: none !important;
    }

    /* 5. Profile Dropdown: Align right edge with app frame & unfurl towards left */
    #profile-dropdown,
    #profile-dropdown.glass-panel {
        right: 0 !important;
        left: auto !important;
        width: 195px !important;
        min-width: 185px !important;
        max-width: calc(100vw - 16px) !important;
        padding: 6px !important;
        border-radius: 12px !important;
        background: var(--glass-bg, #1e293b) !important;
        border: 1px solid var(--glass-border, rgba(255, 255, 255, 0.15)) !important;
        box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5) !important;
        box-sizing: border-box !important;
    }

    body.light-mode #profile-dropdown,
    body.light-mode #profile-dropdown.glass-panel {
        background: #ffffff !important;
        border: 1px solid #cbd5e1 !important;
        box-shadow: 0 10px 25px rgba(0, 0, 0, 0.14) !important;
    }

    #profile-dropdown button {
        white-space: nowrap !important;
        font-size: 0.85rem !important;
        padding: 8px 10px !important;
    }
}

/* --- BREATHING "NEW" FLAG FOR PWA VEHICLE INSPECTION & OCR SCANNER TOOLS --- */
@keyframes pwaNewFlagBreathe {

    0%,
    100% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(244, 63, 94, 0.7), 0 2px 6px rgba(225, 29, 72, 0.45);
    }

    50% {
        transform: scale(1.13);
        box-shadow: 0 0 0 5px rgba(244, 63, 94, 0), 0 4px 12px rgba(244, 63, 94, 0.75);
    }
}

.pwa-new-breathing-flag,
body.light-mode .pwa-new-breathing-flag {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #f43f5e 0%, #e11d48 50%, #f59e0b 100%) !important;
    color: #ffffff !important;
    font-size: 0.56rem !important;
    font-weight: 900 !important;
    letter-spacing: 0.6px !important;
    line-height: 1 !important;
    padding: 3px 6px !important;
    border-radius: 999px !important;
    border: 1px solid rgba(255, 255, 255, 0.65) !important;
    text-transform: uppercase !important;
    animation: pwaNewFlagBreathe 1.5s ease-in-out infinite !important;
    pointer-events: none;
    z-index: 5;
    white-space: nowrap !important;
}


/* --- GENERATE QUOTATION MODAL (#agent-modal) MOBILE & PWA SAFE CLEARANCE --- */
#agent-modal {
    z-index: 10050 !important;
}

#agent-modal .modal-content {
    max-height: 92vh;
    max-height: 92dvh;
    overflow-y: auto;
    box-sizing: border-box;
}

@media (max-width: 768px) {
    #agent-modal {
        padding: 10px 8px calc(74px + env(safe-area-inset-bottom, 0px)) 8px !important;
        align-items: center !important;
        justify-content: center !important;
        overflow-y: auto !important;
        box-sizing: border-box !important;
    }

    #agent-modal .modal-content {
        width: 100% !important;
        max-width: 500px !important;
        max-height: calc(100vh - 90px - env(safe-area-inset-bottom, 0px)) !important;
        max-height: calc(100dvh - 90px - env(safe-area-inset-bottom, 0px)) !important;
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch;
        margin: auto !important;
        padding: 14px 14px 16px 14px !important;
        border-radius: 14px !important;
        box-sizing: border-box !important;
    }

    #agent-modal .modal-header {
        padding: 0 0 8px 0 !important;
        margin-bottom: 10px !important;
    }

    #agent-modal #agent-modal-options {
        padding: 10px !important;
        margin-bottom: 10px !important;
        gap: 8px !important;
    }

    #agent-modal .input-group {
        margin-bottom: 10px !important;
    }

    #agent-modal .modal-actions {
        margin-top: 14px !important;
        padding-bottom: 4px !important;
        display: flex !important;
        flex-direction: row !important;
        align-items: stretch !important;
        gap: 8px !important;
        width: 100% !important;
    }

    #agent-modal .modal-actions>button,
    #agent-modal .modal-actions>div {
        flex: 1 1 0 !important;
        min-width: 0 !important;
    }

    #agent-modal .modal-actions button,
    #agent-modal .modal-actions .calculate-btn {
        min-height: 40px !important;
        height: 100% !important;
        padding: 8px 4px !important;
        font-size: 0.8rem !important;
        box-sizing: border-box !important;
        width: 100% !important;
    }

    #img-btn-container {
        flex: 1 1 0 !important;
        min-width: 0 !important;
        width: auto !important;
    }

    #img-btn-container #generate-img-btn {
        width: 100% !important;
        min-height: 40px !important;
        height: 100% !important;
    }

    #close-agent-modal-btn {
        color: #ef4444 !important;
        font-size: 1.8rem;
        font-weight: 700;
        cursor: pointer;
        line-height: 1;
        transition: transform 0.2s, color 0.2s;
    }

    #close-agent-modal-btn:hover {
        color: #dc2626 !important;
        transform: scale(1.15);
    }
}