/* ==========================================
   COASTAL SHIELD: MASTER STYLESHEET
   ========================================== */

/* --- 1. BASE STYLES & TYPOGRAPHY --- */
body { 
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; 
    background-color: #f1f5f9; 
    color: #334155; 
    margin: 0; 
    padding: 40px; 
}

.container { 
    max-width: 1300px; 
    margin: 0 auto; 
    display: grid; 
    grid-template-columns: 1fr 1fr; 
    gap: 40px; 
}

h1 { 
    color: #183e61; 
    margin-top: 0; 
    font-family: 'Georgia', serif; 
    font-weight: normal; 
    font-size: 32px; 
    border-bottom: 2px solid #e2e8f0; 
    padding-bottom: 16px;
}

.panel { 
    background: #ffffff; 
    padding: 32px; 
    border-radius: 4px; 
    box-shadow: 0 10px 25px rgba(24,62,97,0.05); 
    border: 1px solid #e2e8f0; 
}

/* --- 2. STRUCTURAL GRIDS --- */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }
.grid-4 { display: grid; grid-template-columns: 1fr 1fr 1fr 1fr; gap: 16px; }

/* --- 3. FORMS & INPUTS --- */
label { 
    display: block; 
    font-size: 11px; 
    font-weight: 800; 
    text-transform: uppercase; 
    letter-spacing: 1px; 
    color: #64748b; 
    margin-bottom: 8px; 
    margin-top: 20px; 
}

input, select, textarea { 
    width: 100%; 
    padding: 14px; 
    border: 1px solid #cbd5e1; 
    border-radius: 2px; 
    font-family: inherit; 
    font-size: 14px; 
    box-sizing: border-box; 
    background-color: #f8fafc; 
}

input:focus, select:focus, textarea:focus { 
    outline: none; 
    border-color: #183e61; 
    background-color: #ffffff; 
}

textarea { 
    resize: vertical; 
    min-height: 120px; 
}

.checkbox-label { 
    display: flex; 
    align-items: center; 
    gap: 10px; 
    cursor: pointer; 
    margin-top: 24px; 
    color: #183e61; 
    font-weight: 800; 
    font-size: 13px;
}

.checkbox-label input { 
    width: 18px; 
    height: 18px; 
    margin: 0; 
    cursor: pointer; 
}

/* --- 4. BUTTONS --- */
.btn-primary { 
    background-color: #183e61; 
    color: white; 
    border: none; 
    padding: 16px 24px; 
    border-radius: 2px; 
    font-size: 13px; 
    font-weight: 800; 
    cursor: pointer; 
    margin-top: 24px; 
    transition: background 0.2s; 
    width: 100%; 
    text-transform: uppercase; 
    letter-spacing: 2px;
}
.btn-primary:hover:not(:disabled) { background-color: #609cc3; }
.btn-primary:disabled { background-color: #94a3b8; cursor: not-allowed; }

.btn-secondary { 
    background-color: #e2e8f0; 
    color: #475569; 
    border: none; 
    padding: 12px 24px; 
    border-radius: 2px; 
    font-size: 11px; 
    font-weight: 800; 
    cursor: pointer; 
    transition: background 0.2s; 
    width: 100%; 
    text-transform: uppercase; 
    letter-spacing: 1.5px; 
    margin-top: 12px;
}
.btn-secondary:hover { background-color: #cbd5e1; color: #1e293b; }

.btn-micro { 
    background-color: #f1f5f9; 
    color: #475569; 
    border: 1px solid #cbd5e1; 
    border-radius: 2px; 
    padding: 4px 10px; 
    font-size: 12px; 
    font-weight: bold; 
    cursor: pointer; 
    transition: all 0.1s;
}
.btn-micro:hover { background-color: #e2e8f0; color: #183e61; border-color: #94a3b8;}

.quick-tap { 
    background-color: #e2e8f0; 
    color: #334155; 
    border: none; 
    border-radius: 99px; 
    padding: 4px 10px; 
    font-size: 10px; 
    font-weight: 800; 
    cursor: pointer; 
    transition: background 0.1s; 
    text-transform: uppercase; 
    letter-spacing: 0.5px; 
    white-space: nowrap; 
}
.quick-tap:hover { background-color: #cbd5e1; }

/* --- 5. BUILDER PREVIEW & CODE --- */
#preview-box { 
    padding: 0; 
    border: none; 
    background: transparent; 
    min-height: 200px; 
    margin-bottom: 32px;
}

#code-output { 
    background: #1e293b; 
    color: #a5b4fc; 
    font-family: 'Courier New', monospace; 
    font-size: 11px; 
    padding: 20px; 
    border-radius: 4px; 
    border: none; 
    word-break: break-all; 
    white-space: pre-wrap; 
    height: 180px; 
    overflow-y: auto;
}

/* --- 6. DRAG AND DROP STYLES --- */
.drag-over { 
    border: 2px dashed #10b981 !important; 
    background-color: #f0fdf4 !important; 
    transform: scale(1.02) !important; 
    opacity: 0.8; 
}

/* --- 7. PREMIUM DASHBOARD --- */
.dash-hero {
    background: linear-gradient(135deg, #183e61 0%, #2b5c85 100%);
    border-radius: 12px;
    padding: 48px;
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 20px 40px rgba(24,62,97,0.15);
    margin-bottom: 32px;
    position: relative;
    overflow: hidden;
}

.dash-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 24px;
    position: relative;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 6px rgba(0,0,0,0.02);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-height: 180px;
    cursor: pointer;
}

.dash-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 20px 25px -5px rgba(24,62,97,0.1), 0 10px 10px -5px rgba(24,62,97,0.04);
    border-color: #cbd5e1;
}

.dash-del-btn {
    position: absolute;
    top: 16px;
    right: 16px;
    background: #f1f5f9;
    color: #94a3b8;
    border: none;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
    z-index: 10;
}
.dash-del-btn:hover { background: #fee2e2; color: #ef4444; transform: scale(1.1); }

.dash-badge {
    background: #f1f5f9;
    color: #475569;
    padding: 4px 10px;
    border-radius: 99px;
    font-size: 10px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 1px;
    display: inline-block;
    margin-bottom: 16px;
}

/* --- 8. FINAL CLIENT REPORT UI --- */
#view-report {
    display: flex;
    flex-direction: column;
    height: 100vh;
    width: 100vw;
    position: fixed;
    top: 0; left: 0;
    background: #f1f5f9;
    z-index: 2000;
    overflow: hidden;
}

/* Hide the magic cover uploader in the final web report */
#view-report .cover-upload-btn { display: none !important; }

.report-layout-wrapper { 
    display: flex; 
    flex: 1; 
    height: 100%; 
    overflow: hidden; 
    position: relative; 
}

.report-sidebar {
    width: 340px;
    background: #ffffff;
    border-right: 1px solid #e2e8f0;
    height: 100%;
    display: flex;
    flex-direction: column;
    box-shadow: 4px 0 24px rgba(0,0,0,0.03);
    z-index: 40;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.report-main {
    flex: 1;
    height: 100%;
    overflow-y: auto;
    padding: 60px 80px;
    background: #f8fafc;
    scroll-behavior: smooth;
}

.nav-item {
    padding: 16px 32px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-left: 4px solid transparent;
    border-bottom: 1px solid #f8fafc;
    transition: all 0.2s ease-in-out;
    color: #475569;
}

.nav-item:hover { 
    background: #f1f5f9; 
    border-left-color: #183e61; 
    color: #183e61; 
    transform: translateX(6px); 
}

.nav-item span.nav-title { 
    font-size: 15px; 
    font-weight: 600; 
    display: flex; 
    align-items: center; 
    gap: 16px; 
}

.report-top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(255, 255, 255, 0.75);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid rgba(226, 232, 240, 0.8);
    padding: 12px 32px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.03);
    z-index: 100;
    flex-shrink: 0;
}

.top-bar-actions { 
    display: flex; 
    align-items: center; 
    gap: 16px; 
}

/* Custom Sidebar Scrollbar */
#report-sidebar::-webkit-scrollbar { width: 4px; }
#report-sidebar::-webkit-scrollbar-track { background: transparent; }
#report-sidebar::-webkit-scrollbar-thumb { background: transparent; border-radius: 4px; transition: background 0.3s; }
#report-sidebar:hover::-webkit-scrollbar-thumb { background: #cbd5e1; }

/* Mobile Floating Menu Pill (Hidden on Desktop) */
.mobile-menu-pill {
    display: none;
    position: fixed;
    bottom: 24px;
    left: 24px;
    background: #183e61;
    color: #ffffff;
    border: none;
    padding: 12px 24px;
    border-radius: 99px;
    font-size: 13px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 1px;
    box-shadow: 0 10px 25px rgba(24,62,97,0.4);
    cursor: pointer;
    z-index: 1999;
    align-items: center;
    gap: 10px;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.mobile-menu-pill:hover { 
    transform: translateY(-4px); 
    box-shadow: 0 15px 35px rgba(24,62,97,0.5); 
}


/* ==========================================
   9. ULTIMATE RESPONSIVE ENGINE
   ========================================== */
/* We removed the forced display:block so flex containers don't break! */
.mobile-only { display: none; }

/* Stop Apple iOS from zooming in on input taps */
input, select, textarea {
    font-size: 16px !important; 
    -webkit-appearance: none; 
    border-radius: 4px;
    box-sizing: border-box;
}

/* TABLET (iPads up to 1024px) */
@media (max-width: 1024px) {
    #view-builder { grid-template-columns: 1fr !important; }
    .grid-3, .grid-4 { grid-template-columns: 1fr 1fr !important; }
    #preview-box { margin-top: 16px; }
}

/* REPORT — Tablet & iPad (collapse sidebar above 768px, up to 1024px) */
@media (max-width: 1024px) {
    /* Hide the desktop top bar address — too cramped */
    .rtb-addr { display: none !important; }
    .rtb-sep  { display: none !important; }

    /* Collapse sidebar to a hidden drawer at tablet size — fixed so it doesn't scroll with page */
    .report-sidebar {
        position: fixed !important;
        top: 0 !important; left: 0 !important;
        height: 100vh !important;
        width: 80% !important;
        max-width: 340px !important;
        transform: translateX(-100%) !important;
        z-index: 2000 !important;
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
        overflow-y: auto !important;
    }
    .report-sidebar.open {
        transform: translateX(0) !important;
        box-shadow: 100vw 0 0 rgba(15, 23, 42, 0.55), 20px 0 40px rgba(0,0,0,0.25) !important;
    }
    .report-layout-wrapper { position: relative !important; }

    /* Show the Sections pill on tablet */
    .mobile-menu-pill { display: flex !important; }

    /* Give the report main full width with comfortable padding */
    .report-main {
        padding: 40px 32px !important;
        width: 100% !important;
    }

    /* Tighten the top bar */
    .report-top-bar {
        padding: 0 20px !important;
        height: 52px !important;
    }
}

/* MOBILE (Phones & Z-Folds up to 768px) */
@media (max-width: 768px) {
    /* Kill desktop padding and prevent horizontal scrolling */
    body { 
        padding: 12px !important; 
        overflow-x: hidden !important; 
    }

    /* Any view flagged as hidden stays hidden — belt + suspenders */
    .container[data-hidden="1"] {
        display: none !important;
    }
    
    /* Show the active view as a single-column flex layout */
    .container:not([data-hidden="1"]) {
        display: flex !important;
        flex-direction: column !important;
        width: 100% !important;
        max-width: 100vw !important;
        margin: 0 auto !important;
        padding: 0 !important;
        box-sizing: border-box !important;
        gap: 16px !important;
    }
    
    /* Prevent panels from stretching off screen */
    .panel {
        width: 100% !important;
        max-width: 100% !important;
        padding: 16px !important;
        box-sizing: border-box !important;
        margin: 0 !important;
        min-width: 0 !important; 
        overflow-wrap: break-word !important; 
    }
    
    h1 { 
        font-size: 22px !important; 
        text-align: center !important; 
        padding-bottom: 12px !important; 
    }

    .dash-hero { 
        padding: 32px 20px; 
        text-align: center; 
    }
    
    /* Collapse grids */
    .grid-2, .grid-3, .grid-4 { 
        grid-template-columns: 1fr !important; 
        gap: 12px !important; 
    }
    #standard-inputs .grid-2[style*="1fr auto"] { 
        grid-template-columns: 1fr auto !important; 
    }
    
    /* Stack top headers */
    #view-builder > .panel:first-child { 
        flex-direction: column !important; 
        align-items: stretch !important; 
        gap: 12px; 
    }
    #view-builder > .panel:first-child > div { 
        margin: 0 !important; 
        max-width: 100% !important; 
    }
    
    /* Touch friendly Quick Taps */
    .quick-tap { 
        flex: 1 1 30%; 
        text-align: center; 
        padding: 10px 4px; 
    }
    
    /* Dashboard Cards */
    #section-grid { 
        display: flex !important; 
        flex-direction: column !important; 
        width: 100% !important; 
        gap: 12px !important; 
    }
    
    /* Hide overflowing long words */
    #preview-box, #section-cards-output { 
        overflow-x: hidden; 
        width: 100%; 
        box-sizing: border-box; 
    }
    
    /* Resize Modals */
    #new-report-modal > div, #annotation-modal > div { 
        width: 95% !important; 
        padding: 20px !important; 
        box-sizing: border-box; 
    }
    
    /* FINAL REPORT MOBILE OVERRIDES */
    .desktop-only { display: none !important; }
    .mobile-only { display: block !important; }
    
    /* Reveal the mobile menu pill */
    .mobile-menu-pill { display: flex !important; }
    
    /* Full-Screen Drawer Menu — fixed so it doesn't scroll with the page */
    .report-sidebar {
        position: fixed !important;
        top: 0 !important; left: 0 !important;
        height: 100vh !important;
        width: 85% !important;
        max-width: 360px !important;
        transform: translateX(-100%) !important;
        z-index: 2000 !important;
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
        overflow-y: auto !important;
    }

    .report-sidebar.open {
        transform: translateX(0) !important;
        box-shadow: 100vw 0 0 rgba(15, 23, 42, 0.55), 20px 0 40px rgba(0,0,0,0.3) !important; 
    }
    
    /* On mobile, report-main is full-width and the page body scrolls */
    .report-main { 
        padding: 16px 4px !important;
        width: 100% !important;
        height: auto !important;
        overflow-y: visible !important;
    }
    /* KEY FIX: remove fixed positioning so the body scroll works on mobile.
       position:fixed + height:auto = element expands forever, nothing scrolls. */
    #view-report {
        position: relative !important;
        height: auto !important;
        overflow-y: visible !important;
        overflow-x: hidden !important;
    }
    /* Wrapper must also be auto-height so it doesn't clip the content */
    .report-layout-wrapper {
        height: auto !important;
        overflow: visible !important;
    }
    /* Report page: kill body padding so cards get full width */
    body:has(#view-report:not([data-hidden="1"])) {
        padding: 0 !important;
        overflow-y: auto !important;
        overflow-x: hidden !important;
    }
    body {
        overflow: auto !important;
    }
}

/* ==========================================
   10. PDF DELIVERY ENGINE (PRINT STYLES)
   ========================================== */
@media print {
    @page { margin: 0.6in; }
    body { 
        -webkit-print-color-adjust: exact !important; 
        print-color-adjust: exact !important; 
        background: white !important;
    }
    
    /* Hide all web app buttons and toggles */
    .report-top-bar, .report-sidebar, .mobile-menu-pill, #defects-toggle, .btn-secondary, .btn-primary, .cover-upload-btn, #theme-toggle { 
        display: none !important; 
    }
    body > h1 { display: none !important; }
    
    /* Expand the report pane for printing */
    #view-report, .report-layout-wrapper, .report-main { 
        display: block !important; 
        position: relative !important; 
        height: auto !important; 
        padding: 0 !important; 
        width: 100% !important; 
        max-width: 100% !important; 
        overflow: visible !important; 
        background: white !important;
    }
    
    .print-only-header { display: block !important; }
    .print-page-break { page-break-before: always !important; break-before: page !important; }
    div[style*="page-break-inside: avoid"] { page-break-inside: avoid !important; break-inside: avoid !important; }
}

.print-only-header { display: none; }


/* ==========================================
   11. AMOLED DARK MODE ENGINE
   ========================================== */
body.dark-mode { 
    background-color: #0f172a !important; 
    color: #e2e8f0 !important; 
}

/* Text */
body.dark-mode h1, 
body.dark-mode h2, 
body.dark-mode h3, 
body.dark-mode h4, 
body.dark-mode label, 
body.dark-mode .nav-title {
    color: #f8fafc !important;
}

/* Base Panels */
body.dark-mode .panel, 
body.dark-mode .report-sidebar, 
body.dark-mode .report-main {
    background-color: #1e293b !important;
    border-color: #334155 !important;
    box-shadow: 0 10px 25px rgba(0,0,0,0.4) !important;
}

/* Dashboard Cards */
body.dark-mode .dash-card { 
    background-color: #1e293b !important; 
    border-color: #334155 !important; 
}
body.dark-mode .dash-card:hover { 
    background-color: #27354f !important; 
    border-color: #475569 !important; 
}
body.dark-mode .dash-badge { 
    background-color: #0f172a !important; 
    color: #94a3b8 !important; 
}

/* Inputs */
body.dark-mode input, 
body.dark-mode select, 
body.dark-mode textarea {
    background-color: #0f172a !important; 
    color: #f8fafc !important; 
    border-color: #334155 !important;
}
body.dark-mode input:focus, 
body.dark-mode select:focus, 
body.dark-mode textarea:focus {
    border-color: #10b981 !important; 
    background-color: #1e293b !important;
}

/* Secondary Buttons */
body.dark-mode .btn-secondary, 
body.dark-mode .btn-micro, 
body.dark-mode .quick-tap {
    background-color: #334155 !important; 
    color: #cbd5e1 !important; 
    border-color: #475569 !important;
}
body.dark-mode .btn-secondary:hover, 
body.dark-mode .btn-micro:hover, 
body.dark-mode .quick-tap:hover {
    background-color: #475569 !important; 
    color: #f8fafc !important;
}

/* Mobile Pill */
body.dark-mode .mobile-menu-pill { 
    background-color: #334155; 
    box-shadow: 0 10px 25px rgba(0,0,0,0.6); 
}

/* Component Containers */
body.dark-mode #dashboard-drafts-list > div, 
body.dark-mode #repair-plan-inputs, 
body.dark-mode #diagram-input-container > div > div, 
body.dark-mode #section-grid > div, 
body.dark-mode #fuzzy-results {
    background-color: #1e293b !important; 
    border-color: #334155 !important;
}
body.dark-mode #fuzzy-results > div:hover { 
    background-color: #334155 !important; 
}
body.dark-mode #view-builder > .panel:first-child { 
    background-color: #0f172a !important; 
    border-color: #334155 !important; 
}
body.dark-mode #add-section-container { 
    border-top-color: #334155 !important; 
}

/* Component Pills */
body.dark-mode button[style*="background: #f8fafc"] { 
    background-color: #0f172a !important; 
    border-color: #334155 !important; 
    color: #94a3b8 !important; 
}
body.dark-mode button[style*="background: #dcfce3"] { 
    background-color: #064e3b !important; 
    border-color: #047857 !important; 
    color: #34d399 !important; 
}

/* ==========================================
   12. FORCE INLINE HTML CARDS INTO DARK MODE
   ========================================== */

/* 1. Convert White/Light Grey Backgrounds to Dark Slate */
body.dark-mode [style*="background-color: #ffffff"],
body.dark-mode [style*="background-color: #f8fafc"],
body.dark-mode [style*="background: #f8fafc"] {
    background-color: #1e293b !important;
    border-color: #334155 !important;
}

/* 2. Convert Dark Grey/Slate Text to Light Grey */
body.dark-mode [style*="color: #334155"],
body.dark-mode [style*="color: #475569"],
body.dark-mode [style*="color:#64748b"],
body.dark-mode [style*="color: #64748b"] {
    color: #cbd5e1 !important;
}

/* 3. Convert Navy Blue Headings to a Readable Light Blue */
body.dark-mode [style*="color: #183e61"],
body.dark-mode [style*="color:#183e61"] {
    color: #93c5fd !important;
}

/* 4. Adjust Tinted Defect Boxes (Green, Orange, Red) */
body.dark-mode [style*="background-color: #f0fdf4"], 
body.dark-mode [style*="background-color: #f0f8ff"] {
    background-color: #064e3b !important;
    border-color: #047857 !important;
}
body.dark-mode [style*="background-color: #fffaf5"] {
    background-color: #451a03 !important;
    border-color: #78350f !important;
}
body.dark-mode [style*="background-color: #fff5f5"],
body.dark-mode [style*="background-color: #fef2f2"] {
    background-color: #4c0519 !important;
    border-color: #881337 !important;
}

/* 5. Convert Defect Text Colors */
body.dark-mode [style*="color:#065f46"], body.dark-mode [style*="color: #065f46"],
body.dark-mode [style*="color:#166534"], body.dark-mode [style*="color: #166534"],
body.dark-mode [style*="color:#047857"], body.dark-mode [style*="color: #047857"] {
    color: #a7f3d0 !important;
}
body.dark-mode [style*="color:#e65c00"], body.dark-mode [style*="color: #e65c00"] {
    color: #fdba74 !important;
}
body.dark-mode [style*="color:#9f1239"], body.dark-mode [style*="color: #9f1239"],
body.dark-mode [style*="color:#be123c"], body.dark-mode [style*="color: #be123c"] {
    color: #fecdd3 !important;
}

/* 6. Soften harsh borders */
body.dark-mode [style*="border: 1px solid #cbd5e1"],
body.dark-mode [style*="border-bottom: 2px solid #e2e8f0"],
body.dark-mode [style*="border: 1px solid #e2e8f0"],
body.dark-mode [style*="border-bottom: 1px solid #e2e8f0"] {
    border-color: #334155 !important;
}
/* =====================================================
   TOOLBOX — append to the bottom of styles.css
   ===================================================== */

/* Pill hover */
#toolbox-pill:hover {
    transform: translateY(-2px);
    box-shadow: 0 14px 30px rgba(16,185,129,0.5);
}

/* Dark mode: flip the pill to match */
body.dark-mode #toolbox-pill {
    background: #059669;
    border-color: #047857;
    box-shadow: 0 10px 25px rgba(0,0,0,0.5);
}

/* Dark mode: panel */
body.dark-mode #toolbox-panel {
    background: #1e293b !important;
}
body.dark-mode #toolbox-panel h3,
body.dark-mode #toolbox-panel h4 {
    color: #93c5fd !important;
}
body.dark-mode #toolbox-panel p,
body.dark-mode #toolbox-panel label {
    color: #94a3b8 !important;
}

/* Pulsing robot animation for loading state */
@keyframes tb-pulse {
    0%, 100% { transform: scale(1);   opacity: 1;   }
    50%       { transform: scale(1.1); opacity: 0.7; }
}

/* ── Chat starter chips ── */
.ask-chip {
    text-align: left;
    background: #f8fafc;
    border: 1.5px solid #e2e8f0;
    border-radius: 10px;
    padding: 10px 14px;
    font-size: 13px;
    color: #334155;
    cursor: pointer;
    font-weight: 600;
    transition: background 0.15s, border-color 0.15s;
    -webkit-tap-highlight-color: transparent;
}
.ask-chip:hover { background: #ede9fe; border-color: #c4b5fd; color: #5b21b6; }

/* ── Typing dots ── */
@keyframes tb-bounce {
    0%, 80%, 100% { transform: translateY(0);    opacity: 0.4; }
    40%            { transform: translateY(-5px); opacity: 1;   }
}

/* ── Send button hover ── */
#ask-send-btn:hover:not(:disabled) { background: #4c1d95; }
#ask-send-btn:disabled { background: #a78bfa; cursor: default; }
/* ── Hide toolbox + theme toggle in print ── */
@media print {
    #toolbox-pill, #toolbox-panel, #toolbox-backdrop, #theme-toggle, #publish-btn {
        display: none !important;
    }
}

/* ── Fix dark mode component pills on outline ── */
body.dark-mode #section-grid button[style*="background: #f8fafc"],
body.dark-mode #section-grid button[style*="background: #dcfce3"] {
    color: #e2e8f0 !important;
}
body.dark-mode #section-grid button[style*="background: #f8fafc"] {
    background-color: #1e293b !important;
    border-color: #475569 !important;
    color: #94a3b8 !important;
}
body.dark-mode #section-grid button[style*="background: #dcfce3"] {
    background-color: #064e3b !important;
    border-color: #047857 !important;
    color: #34d399 !important;
}
/* ════════════════════════════════════════════
   MOBILE EDGE TOOLBAR
   ════════════════════════════════════════════ */

/* The small tab on the right edge */
#mobile-toolbar-tab {
    display: none; /* Hidden on desktop */
    position: fixed;
    right: 0;
    bottom: 50%;
    transform: translateY(50%);
    background: #183e61;
    color: white;
    border: 1px solid #2b5c85;
    border-right: none;
    border-radius: 12px 0 0 12px;
    padding: 12px 8px;
    font-size: 16px;
    cursor: pointer;
    z-index: 9998;
    box-shadow: -4px 0 12px rgba(24,62,97,0.15);
    transition: all 0.2s;
    -webkit-tap-highlight-color: transparent;
}
#mobile-toolbar-tab:active {
    background: #2b5c85;
}

/* The drawer that slides out */
#mobile-toolbar-drawer {
    display: none; /* Hidden on desktop */
    position: fixed;
    right: 0;
    bottom: 50%;
    transform: translateY(50%) translateX(100%);
    background: white;
    border: 1px solid #e2e8f0;
    border-right: none;
    border-radius: 16px 0 0 16px;
    padding: 12px;
    flex-direction: column;
    gap: 8px;
    z-index: 9999;
    box-shadow: -8px 0 24px rgba(0,0,0,0.12);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    width: 200px;
}
#mobile-toolbar-drawer.mobile-toolbar-open {
    transform: translateY(50%) translateX(0);
}
#mobile-toolbar-drawer.mobile-toolbar-closed {
    transform: translateY(50%) translateX(100%);
}

/* Dark mode */
body.dark-mode #mobile-toolbar-tab {
    background: #334155;
    border-color: #475569;
}
body.dark-mode #mobile-toolbar-drawer {
    background: #1e293b;
    border-color: #334155;
    box-shadow: -8px 0 24px rgba(0,0,0,0.4);
}

/* MOBILE: show edge drawer, hide floating pills */
@media (max-width: 768px) {
    #mobile-toolbar-tab {
        display: flex;
        justify-content: center;
        align-items: center;
    }
    #mobile-toolbar-drawer {
        display: flex;
    }

    /* Hide the original floating buttons on mobile */
    #toolbox-pill {
        display: none !important;
    }
    #theme-toggle {
        display: none !important;
    }
}