    /* Base Styles */
    #alc-lye-form {
        max-width: 100%;
        width: 100%;
        padding: 20px;
        background: #f7f7f7;
        border-radius: 10px;
        box-sizing: border-box;
    }

    #alc-lye-form input,
    #alc-lye-form select,
    #alc-lye-form button {
        margin: 5px 0;
        width: 100%;
        padding: 10px;
        font-size: 1rem;
        box-sizing: border-box;
    }

    /* Prevent inline/utility buttons inside section cards from inheriting
       the global width:100% rule. The Refresh button in the Saved Batches
       h4 (display:flex; justify-content:space-between) was stretching to
       fill all remaining space, making it look like an empty input field.
       Table row action buttons (Load/Compare/Delete) were also expanding
       to fill the full table cell width. */
    #alc-history-section h4 button,
    #alc-compare-section > button,
    #alc-history-list td button,
    #alc-compare-table td button,
    #alc-fluid-section button,
    #alc-fragrance-section button,
    #alc-mold-section button,
    #alc-scale-section button {
        width: auto !important;
        padding: 3px 10px !important;
        margin: 0 2px !important;
        font-size: 0.82em !important;
    }

    .oil-input {
        display: flex;
        flex-wrap: wrap;
        gap: 8px;
        margin-bottom: 10px;
        width: 100%;
        align-items: center;
    }

    .oil-input select,
    .oil-input input {
        flex: 1 1 100%;
        min-width: 120px;
    }

    @media (min-width: 760px) {
        .oil-input {
            flex-wrap: nowrap;
        }

        .oil-search-wrap {
            flex: 3 1 0 !important;
            min-width: 0 !important;
        }

        .oil-input input[name="weight[]"] {
            flex: 1 1 0 !important;
            min-width: 80px !important;
            max-width: 120px !important;
        }

        .custom-sap-input {
            flex: 1 1 0 !important;
            min-width: 80px !important;
            max-width: 150px !important;
            width: auto !important;
        }

        .oil-price-input {
            flex: 1 1 0 !important;
            min-width: 90px !important;
            max-width: 160px !important;
            width: auto !important;
        }

        .oil-minmax-input {
            flex: 1 1 0 !important;
            min-width: 70px !important;
            max-width: 100px !important;
            width: auto !important;
        }

        .remove-oil-btn {
            flex: 0 0 auto !important;
        }
    }

    @media (min-width: 768px) {
        #alc-lye-form {
            max-width: 860px;
            margin: auto;
        }
    }

    table {
        width: 100%;
        border-collapse: collapse;
        margin-top: 20px;
        overflow-x: auto;
    }

    table th,
    table td {
        border: 1px solid #ccc;
        padding: 8px;
        text-align: left;
    }

    table thead {
        background-color: #eee;
    }

    #graph-container {
        width: 100%;
        max-width: 100%;
        overflow-x: auto;
    }

    #property-chart {
        width: 100% !important;
        height: auto !important;
    }

    pre {
        overflow-x: auto;
        white-space: pre-wrap;
        word-break: break-word;
    }
.tooltip-container {
    position: relative;
    display: inline-block;
    cursor: help;
    margin-left: 4px;
    color: #0073aa;
}

.tooltip-container:hover .tooltip-text,
.tooltip-container.alc-tooltip-active .tooltip-text {
    visibility: visible;
    opacity: 1;
}

.tooltip-text {
    visibility: hidden;
    width: max-content;
    max-width: 280px;
    background-color: #333;
    color: #fff;
    text-align: left;
    border-radius: 6px;
    padding: 8px;
    /* Positioned via JS (see alc-lye-calculator.js) using fixed coordinates
       clamped to the viewport. Fixed (not absolute) so it's never clipped
       by an ancestor's overflow:auto — e.g. the horizontally-scrollable
       property table — and never runs off-screen regardless of where the
       trigger icon sits. top/left are set inline by JS before it's shown. */
    position: fixed;
    top: 0;
    left: 0;
    z-index: 9999;
    opacity: 0;
    transition: opacity 0.15s ease;
    font-size: 0.9rem;
    line-height: 1.3;
    box-shadow: 0 2px 6px rgba(0,0,0,0.3);
}

.recommend-blend-box {
    background: #f0f4ff;
    border: 1px solid #c0cfe8;
    border-radius: 10px;
    padding: 20px;
    margin-top: 20px;
}
.recommend-blend-box h3 {
    font-size: 1.2rem;
    color: #1a3a6b;
    margin-bottom: 12px;
}
/* Undo banner shown after "Apply Recommended Weights" */
.alc-undo-banner {
    display: none;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    background: #d4edda;
    border: 1px solid #a3cfbb;
    border-radius: 7px;
    padding: 9px 14px;
    margin-bottom: 12px;
    font-size: 0.9rem;
    color: #155724;
}
.alc-undo-banner button {
    background: #155724;
    color: #fff;
    border: none;
    border-radius: 5px;
    padding: 5px 12px;
    font-size: 0.85rem;
    cursor: pointer;
    white-space: nowrap;
}
.alc-undo-banner button:hover {
    background: #0f3d1a;
}
/* Recommend button loading state */
#recommend-btn:disabled {
    opacity: 0.7;
    cursor: wait;
}
.blend-ok {
    background: #d4edda;
    border-radius: 8px;
    padding: 14px 18px;
    font-size: 1rem;
    color: #155724;
}
.blend-issues {
    display: flex;
    flex-direction: column;
    gap: 14px;
}
.blend-issue-card {
    border-radius: 8px;
    padding: 14px 16px;
    border: 1px solid rgba(0,0,0,0.1);
}
.blend-issue-header {
    font-size: 1rem;
    margin-bottom: 6px;
}
.blend-advice {
    color: #555;
    font-size: 0.9rem;
    margin-bottom: 10px;
}
.blend-oil-suggestions {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.blend-oil-group {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
}
.blend-tag {
    font-size: 0.8rem;
    font-weight: bold;
    padding: 2px 8px;
    border-radius: 4px;
    white-space: nowrap;
}
.blend-tag.in-recipe {
    background: #007bff;
    color: #fff;
}
.blend-tag.not-in-recipe {
    background: #6c757d;
    color: #fff;
}
.oil-chip {
    display: inline-block;
    font-size: 0.8rem;
    padding: 3px 10px;
    border-radius: 20px;
    white-space: nowrap;
}
.oil-chip.in {
    background: #cfe2ff;
    color: #084298;
    border: 1px solid #b6d4fe;
}
.oil-chip.out {
    background: #e2e3e5;
    color: #383d41;
    border: 1px solid #d6d8db;
}
#recommend-btn {
    background: #28a745;
    color: #fff;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: bold;
}
#recommend-btn:hover {
    background: #218838;
}


.reco-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.92rem;
}
.reco-table th, .reco-table td {
    border: 1px solid #ccc;
    padding: 7px 10px;
    text-align: left;
}
.reco-table thead {
    background: #e8edf5;
}


/* ── Searchable Oil Dropdown ── */
.oil-search-wrap {
    position: relative;
    flex: 1 1 100%;
    min-width: 150px;
}
.oil-search-input {
    width: 100%;
    padding: 10px;
    font-size: 1rem;
    box-sizing: border-box;
    border: 1px solid #ccc;
    border-radius: 4px;
    background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23888' stroke-width='2'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cline x1='21' y1='21' x2='16.65' y2='16.65'/%3E%3C/svg%3E") no-repeat 10px center;
    padding-left: 32px;
}
.oil-search-input:focus {
    outline: none;
    border-color: #4a90e2;
    box-shadow: 0 0 0 3px rgba(74,144,226,0.15);
}
.oil-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 2px);
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid #ccc;
    border-radius: 6px;
    max-height: 220px;
    overflow-y: auto;
    z-index: 9999;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}
.oil-drop-item {
    padding: 8px 12px;
    cursor: pointer;
    font-size: 0.92rem;
    border-bottom: 1px solid #f0f0f0;
    transition: background 0.1s;
}
.oil-drop-item:last-child { border-bottom: none; }
.oil-drop-item:hover { background: #eef4ff; }
.oil-drop-item strong { color: #1a5fc8; }
.oil-drop-more {
    padding: 6px 12px;
    font-size: 0.8rem;
    color: #888;
    font-style: italic;
    background: #f9f9f9;
}
.remove-oil-btn {
    flex: 0 0 auto;
    width: auto !important;
    padding: 8px 14px !important;
    background: #dc3545;
    color: #fff;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 1rem;
    align-self: center;
}
.remove-oil-btn:hover { background: #b02a37; }


.oil-sap-badge {
    color: #888;
    font-size: 0.82rem;
    margin-left: 4px;
    font-style: italic;
}


/* Custom SAP override input */
.custom-sap-input {
    flex: 1 1 100%;
    font-size: 0.88rem;
    padding: 7px 10px;
    border: 1px dashed #1565c0;
    border-radius: 6px;
    background: #f0f6ff;
    color: #1565c0;
    box-sizing: border-box;
}
.custom-sap-input:focus {
    border-color: #0d47a1;
    background: #e3f0ff;
    outline: none;
    box-shadow: 0 0 0 2px rgba(13,71,161,0.18);
}
.custom-sap-input::placeholder {
    font-size: 0.8rem;
    color: #90caf9;
}
.custom-sap-input:disabled,
.alc-pro-locked-input {
    background: #f2f2f2;
    border-style: dashed;
    color: #999;
    cursor: not-allowed;
    opacity: 0.75;
}

.custom-sap-input {
    flex: 1 1 100%;
    font-size: 0.88rem;
    padding: 7px 10px;
    border: 1px dashed #1565c0;
    border-radius: 6px;
    background: #f0f6ff;
    color: #1565c0;
    box-sizing: border-box;
}
.custom-sap-input:focus {
    border-color: #0d47a1;
    background: #e3f0ff;
    outline: none;
    box-shadow: 0 0 0 2px rgba(13,71,161,0.18);
}
.custom-sap-input::placeholder {
    font-size: 0.8rem;
    color: #90caf9;
}
.custom-sap-input:disabled,
.alc-pro-locked-input {
    background: #f2f2f2;
    border-style: dashed;
    color: #999;
    cursor: not-allowed;
    opacity: 0.75;
}

/* Oil price input (Pro feature) */
.oil-price-input {
    flex: 1 1 100%;
    font-size: 0.88rem;
    padding: 7px 10px;
    border: 1px dashed #1565c0;
    border-radius: 6px;
    background: #f0f6ff;
    color: #1565c0;
    box-sizing: border-box;
}
.oil-price-input:focus {
    border-color: #0d47a1;
    background: #e3f0ff;
    outline: none;
    box-shadow: 0 0 0 2px rgba(13,71,161,0.18);
}
.oil-price-input::placeholder {
    font-size: 0.8rem;
    color: #90caf9;
}
.oil-price-input.alc-pro-locked-input {
    background: #f2f2f2;
    border-style: dashed;
    border-color: #aaa;
    color: #999;
    cursor: not-allowed;
    opacity: 0.75;
}
#naoh-price-per-kg::placeholder,
#koh-price-per-kg::placeholder {
    color: #90caf9;
}

/* Min %/Max % inputs (Pro feature — Recommend Blend bounds) */
.oil-minmax-input {
    flex: 1 1 100%;
    font-size: 0.88rem;
    padding: 7px 10px;
    border: 1px dashed #1565c0;
    border-radius: 6px;
    background: #f0f6ff;
    color: #1565c0;
    box-sizing: border-box;
}
.oil-minmax-input:focus {
    border-color: #0d47a1;
    background: #e3f0ff;
    outline: none;
    box-shadow: 0 0 0 2px rgba(13,71,161,0.18);
}
.oil-minmax-input::placeholder {
    font-size: 0.8rem;
    color: #90caf9;
}
.oil-minmax-input.alc-pro-locked-input {
    background: #f2f2f2;
    border-style: dashed;
    border-color: #aaa;
    color: #999;
    cursor: not-allowed;
    opacity: 0.75;
}

/* Pro-locked button (e.g. Recommend Blend) */
.alc-pro-locked {
    opacity: 0.6;
    cursor: not-allowed;
    position: relative;
}
.alc-pro-locked::after {
    content: "Pro";
    display: inline-block;
    margin-left: 6px;
    font-size: 0.7rem;
    font-weight: 700;
    background: #856404;
    color: #fff3cd;
    padding: 1px 6px;
    border-radius: 3px;
    vertical-align: middle;
}

/* Upgrade-to-Pro banner shown above the form for non-Pro users */
.alc-upgrade-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    background: linear-gradient(90deg, #fff7e0, #fff3cd);
    border: 1px solid #f0d98c;
    border-radius: 8px;
    padding: 10px 14px;
    margin-bottom: 16px;
}
.alc-upgrade-banner-text {
    font-size: 0.82rem;
    color: #7a5800;
    flex: 1;
    min-width: 0;
}
.alc-expired-note {
    color: #a00;
    font-weight: 600;
    font-size: 0.92rem;
}
.alc-upgrade-btn {
    background: #856404;
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: 8px 16px;
    font-weight: 600;
    cursor: pointer;
    margin-left: auto;
}
.alc-upgrade-btn:hover {
    background: #6b4f03;
}

/* Upgrade-to-Pro modal */
.alc-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.55);
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}
.alc-modal-box {
    background: #fff;
    border-radius: 10px;
    max-width: 640px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    padding: 28px 24px 24px;
    position: relative;
    box-shadow: 0 12px 40px rgba(0,0,0,0.25);
}
.alc-modal-close {
    position: absolute;
    top: 10px;
    right: 14px;
    background: none;
    border: none;
    font-size: 1.6rem;
    line-height: 1;
    cursor: pointer;
    color: #888;
}
.alc-modal-close:hover {
    color: #222;
}
.alc-modal-box h3 {
    margin-top: 0;
    margin-bottom: 4px;
}
.alc-modal-sub {
    color: #666;
    margin-top: 0;
    margin-bottom: 14px;
}
/* Pro features checklist */
.alc-pro-features-list {
    list-style: none;
    margin: 0 0 20px;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.alc-pro-features-list li {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 10px 14px;
}
.alc-pro-feat-icon {
    font-size: 1.35rem;
    line-height: 1.4;
    flex-shrink: 0;
}
.alc-pro-features-list li div {
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.alc-pro-features-list li strong {
    font-size: 0.95rem;
    color: #1a1a1a;
}
.alc-pro-features-list li span {
    font-size: 0.84rem;
    color: #555;
    line-height: 1.4;
}
.alc-modal-bonus {
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    border-radius: 8px;
    padding: 10px 14px;
    margin: -6px 0 18px;
    color: #166534;
    font-size: 0.9em;
    text-align: center;
}
.alc-plans-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 14px;
    margin-bottom: 14px;
}
.alc-plan-card {
    border: 1px solid #e3e3e3;
    border-radius: 8px;
    padding: 16px 12px;
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 6px;
    position: relative;
}
.alc-plan-name {
    font-weight: 700;
    font-size: 1rem;
}
.alc-plan-duration {
    color: #777;
    font-size: 0.85rem;
}
.alc-plan-price {
    font-size: 1.3rem;
    font-weight: 800;
    color: #1d6f3a;
    margin: 4px 0;
}
.alc-plan-rate {
    color: #777;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    flex-wrap: wrap;
}
.alc-plan-save {
    display: inline-block;
    background: #fff3cd;
    color: #856404;
    border: 1px solid #f0d98c;
    border-radius: 999px;
    padding: 1px 8px;
    font-size: 0.72rem;
    font-weight: 700;
    white-space: nowrap;
}
/* Best-value plan (e.g. the 365-Day Pass): gold border + lift + corner badge */
.alc-plan-card.alc-plan-highlight {
    border: 2px solid #f0b429;
    box-shadow: 0 4px 14px rgba(240,180,41,0.25);
    transform: translateY(-2px);
}
.alc-plan-badge {
    position: absolute;
    top: -10px;
    left: 50%;
    transform: translateX(-50%);
    background: #f0b429;
    color: #4a3500;
    font-size: 0.68rem;
    font-weight: 800;
    letter-spacing: 0.03em;
    padding: 2px 10px;
    border-radius: 999px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.15);
    white-space: nowrap;
}
/* Free-trial card: visually distinct from the paid passes (dashed, no price) */
.alc-plan-card.alc-plan-trial {
    border: 2px dashed #93c5fd;
    background: #f0f7ff;
}
.alc-plan-trial-btn {
    background: #2563eb !important;
    text-decoration: none;
    display: inline-block;
}
.alc-plan-trial-btn:hover {
    background: #1d4ed8 !important;
}
.alc-plan-trial-btn[disabled] {
    background: #9ca3af !important;
    cursor: not-allowed;
}
.alc-plan-buy-btn {
    background: #25D366;
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: 8px 10px;
    font-weight: 600;
    cursor: pointer;
}
.alc-plan-buy-btn:hover {
    background: #1ebc59;
}
.alc-modal-footnote {
    font-size: 0.8rem;
    color: #888;
    text-align: center;
    margin: 10px 0 0;
}


/* SOP download button */
#alc-sop-btn {
    background: #2e7d32;
    color: #fff;
    border: none;
    border-radius: 5px;
    padding: 8px 14px;
    font-weight: 600;
    cursor: pointer;
    margin-left: 6px;
}
#alc-sop-btn:hover:not(.alc-pro-locked) {
    background: #1b5e20;
}
#alc-sop-btn.alc-pro-locked {
    background: #9e9e9e;
    color: #fff;
}

/* ═══════════════════════════════════════════════════════════════
   Advanced Lye Calculator — New Features (v2.3.0)
   Features: unit toggle, scaling, presets, mold, fragrance,
             fluid substitution, batch history, comparison
   ═══════════════════════════════════════════════════════════════ */

/* ── Section cards ── */
#alc-fluid-section,
#alc-mold-section,
#alc-fragrance-section,
#alc-history-section,
#alc-compare-section,
#alc-scale-section {
    background: #fafafa;
    border: 1px solid #e8e8e8;
    border-radius: 8px;
    padding: 16px 18px;
}

#alc-fluid-section h4,
#alc-mold-section h4,
#alc-fragrance-section h4,
#alc-history-section h4,
#alc-compare-section h4,
#alc-scale-section h4 {
    margin-top: 0;
    margin-bottom: 10px;
    font-size: 1em;
    color: #333;
}

/* ── Unit toggle ── */
#alc-unit-toggle {
    background: #f0f4ff;
    border: 1px solid #c5d5f5;
    border-radius: 6px;
    padding: 8px 14px;
    flex-wrap: wrap; /* desktop default — mobile media query below overrides to nowrap */
}
#alc-unit-toggle label {
    cursor: pointer;
}

/* ── Preset select ── */
#alc-preset-select {
    background: #fff;
    border: 1px solid #ccc;
    border-radius: 4px;
    padding: 5px 8px;
    font-size: 0.92em;
    cursor: pointer;
}

/* ── Batch name input ── */
#batch-name {
    width: 100%;
    box-sizing: border-box;
}

/* ── History table ── */
#alc-history-list {
    width: 100%;
    box-sizing: border-box;
}
#alc-history-list table {
    width: 100%;
    box-sizing: border-box;
    border: 1px solid #e8e8e8;
    border-radius: 6px;
    overflow: hidden;
}
#alc-history-list thead tr {
    background: #f5f5f5;
}
#alc-history-list tbody tr:hover {
    background: #f9f9f9;
}

/* ── Comparison table ── */
#alc-compare-table table {
    border: 1px solid #e8e8e8;
    border-radius: 6px;
    overflow: hidden;
}

/* ── Result info boxes ── */
#alc-mold-result > div,
#alc-fragrance-result > div,
#alc-fluid-result > div {
    transition: opacity 0.2s;
}

/* ── Mold dimension inputs layout ── */
#alc-mold-dims-rect,
#alc-mold-dims-cyl {
    gap: 8px;
    flex-wrap: wrap;
}

/* ── Scale section ── */
#alc-scale-section input[type="number"] {
    border: 1px solid #ccc;
    border-radius: 4px;
    padding: 5px 8px;
    font-size: 0.92em;
}

/* ═══════════════════════════════════════════════════════════════
   Mobile Responsive — ≤ 600px
   ═══════════════════════════════════════════════════════════════ */
@media (max-width: 600px) {

    /* ── Form container ── */
    #alc-lye-form {
        padding: 12px;
        border-radius: 8px;
    }

    /* ── Unit toggle ── */
    #alc-unit-toggle {
        flex-wrap: nowrap;
        gap: 6px;
        padding: 8px 10px;
        justify-content: space-between;
    }
    #alc-unit-toggle .alc-unit-fullname {
        display: none; /* "grams" hidden — just the "(g)" abbreviation stays, so all four fit on one line */
    }
    #alc-unit-toggle label {
        font-size: 0.82em;
        white-space: nowrap;
        display: flex;
        align-items: center;
        gap: 3px;
    }

    /* ── Target Props: 4-column grid → 2-column on mobile ── */
    #alc-target-props-grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }

    /* ── Action buttons row (Calculate / Download / Save) ── */
    #alc-lye-form > div[style*="display:flex"][style*="flex-wrap:wrap"],
    #alc-lye-form > div[style*="display: flex"][style*="flex-wrap: wrap"] {
        flex-direction: column;
    }

    /* ── Lye / water option rows ── */
    div[style*="display:flex"][style*="gap:12px"][style*="flex-wrap:wrap"],
    div[style*="display:flex"][style*="gap:10px"][style*="flex-wrap:wrap"] {
        flex-wrap: wrap !important;
        gap: 6px !important;
    }

    /* ── Section cards: reduce padding ── */
    #alc-fluid-section,
    #alc-mold-section,
    #alc-fragrance-section,
    #alc-history-section,
    #alc-compare-section,
    #alc-scale-section {
        padding: 10px 12px;
    }

    /* ── History table: horizontal scroll + compact font ── */
    #alc-history-list {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    #alc-history-list table {
        font-size: 0.78em;
        min-width: 480px;
    }
    /* Make action buttons in table rows more compact */
    #alc-history-list td button {
        padding: 2px 6px !important;
        font-size: 0.75em !important;
        margin: 0 1px !important;
    }

    /* ── Comparison table: scroll ── */
    #alc-compare-table {
        font-size: 0.78em;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    /* ── Mold & scale inputs: full width on mobile ── */
    #alc-mold-dims-rect input,
    #alc-mold-dims-cyl input,
    #alc-scale-section input[type="number"] {
        width: 100% !important;
        box-sizing: border-box;
    }
    #alc-mold-dims-rect,
    #alc-mold-dims-cyl {
        flex-direction: column;
    }

    /* ── Fluid / fragrance / mold / scale inner flex rows ── */
    #alc-fluid-section > div[style*="display:flex"],
    #alc-fragrance-section > div[style*="display:flex"],
    #alc-mold-section .alc-mold-body > div[style*="display:flex"],
    #alc-scale-section > div[style*="display:flex"] {
        flex-wrap: wrap !important;
        gap: 6px !important;
    }

    /* ── Section collapse headers: prevent text overflow ── */
    #alc-fluid-section > div[style*="justify-content:space-between"],
    #alc-fragrance-section > div[style*="justify-content:space-between"],
    #alc-mold-section > div[style*="justify-content:space-between"],
    #alc-scale-section > div[style*="justify-content:space-between"] {
        gap: 6px;
    }

    /* ── Saved Batches h4 header ── */
    #alc-history-section h4 {
        flex-wrap: wrap;
        gap: 6px;
    }

    /* ── Main result/property tables ── */
    #property-table,
    #fatty-acid-table,
    .reco-table {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        font-size: 0.82em;
    }

    /* ── Upgrade banner: stack vertically ── */
    .alc-upgrade-banner {
        flex-direction: column;
        align-items: flex-start;
    }
    .alc-upgrade-btn {
        width: 100%;
        text-align: center;
    }

    /* ── Plans grid in modal: 1 column ── */
    .alc-plans-grid {
        grid-template-columns: 1fr;
    }

    /* ── Recommend blend box ── */
    .blend-oil-group {
        flex-direction: column;
        align-items: flex-start;
    }

    /* ── Undo banner ── */
    .alc-undo-banner {
        flex-direction: column;
        align-items: flex-start;
        gap: 6px;
    }
    .alc-undo-banner button {
        width: 100%;
    }
}


/* ── Extra-small screens (≤ 380px) ── */
@media (max-width: 380px) {
    #alc-lye-form {
        padding: 8px;
    }
    #alc-lye-form input,
    #alc-lye-form select,
    #alc-lye-form button {
        font-size: 0.9rem;
        padding: 8px;
    }
    #alc-history-section h4 span {
        font-size: 0.9em;
    }
}
