﻿/* Mineral additive type column alignment */
.additive-list-header .additive-type-col {
    min-width: 36px;
    width: 36px;
    font-size: 10px;
    font-weight: 700;
    text-align: left;
    display: inline-block;
    margin-left: 0;
    padding-left: 0;
    padding-right: 0;
}
.mineral-compact .input-with-suffix {
    display: inline-flex;
    align-items: center;
    margin-left: 0;
    justify-content: flex-start;
}
.mineral-compact .type-select-list {
    min-width: 48px;
    width: auto;
    margin-left: 0;
    margin-right: 0.3em;
    text-align: left;
    padding: var(--space-sm) var(--space-md);
    font-size: 13px;
    font-family: var(--font-mono);
    font-weight: 500;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--surface-panel);
    color: var(--text-primary);
    box-sizing: border-box;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' viewBox='0 0 12 8' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M2 2L6 6L10 2' stroke='%23999' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.5em center;
    background-size: 0.7em;
    padding-right: 1.5em;
}
/* Disabled style for mineral additive type dropdown */
.type-select-list:disabled {
    background: var(--surface-panel);
    color: var(--text-tertiary);
    opacity: 0.6;
    cursor: not-allowed;
}
/* === Submenu trigger for level 3 === */
.has-class-submenu {
    position: relative;
}
.has-class-submenu:after {
    content: '\25B6';
    position: absolute;
    right: 0.7em;
    color: var(--accent-orange);
    font-size: 0.9em;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
}
/* === Third-level submenu for aggregate class === */
.class-submenu {
    display: none;
    position: absolute;
    left: 100%;
    top: 0;
    margin-left: 0.5em;
    min-width: 110px;
    background: var(--surface-elevated);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    z-index: 30;
    margin-left: 2px;
    padding: 0.2em 0;
}
.has-class-submenu:hover > .class-submenu {
    display: block;
}
.class-submenu li {
    padding: 0.4em 1em;
    font-size: 13px;
    color: var(--text-primary);
    background: none;
    white-space: nowrap;
    cursor: pointer;
}
.class-submenu li:hover {
    background: var(--accent-orange);
    color: #fff;
}
/* === Aggregate Type Cascading Dropdown === */
.agg-cascade-dropdown {
    position: relative;
    display: block;
    width: 100%;
}
.agg-cascade-btn {
    /* Match standard select styling exactly */
    padding: var(--space-sm) var(--space-md);
    background: var(--surface-panel);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: 13px;
    font-weight: 500;
    line-height: 1.4;
    transition: all var(--transition-base);
    width: 100%;
    box-sizing: border-box;
    text-align: left;
    cursor: pointer;
    appearance: none;
    outline: none;
    /* Dropdown arrow like select */
    background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' viewBox='0 0 12 8' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M2 2L6 6L10 2' stroke='%23999' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.7em center;
    background-size: 0.8em;
    padding-right: 2em;
}
.agg-cascade-btn:hover, .agg-cascade-btn:focus {
    outline: none;
    border-color: var(--accent-orange);
    box-shadow: 0 0 0 3px rgba(255, 107, 53, 0.1);
}
.agg-cascade-menu {
    display: none;
    position: absolute;
    left: 0;
    top: 100%;
    width: 100%;
    min-width: 150px;
    background: var(--surface-elevated);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    z-index: 100;
    margin: 0;
    padding: 0.3em 0;
    list-style: none;
}
.agg-cascade-dropdown.open > .agg-cascade-menu {
    display: block;
}
.agg-cascade-menu > li {
    position: relative;
    padding: var(--space-sm) var(--space-md);
    cursor: pointer;
    font-size: 13px;
    color: var(--text-primary);
    white-space: nowrap;
    transition: background 0.12s;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.agg-cascade-menu > li:hover {
    background: var(--accent-orange);
    color: #fff;
}
.agg-cascade-menu > li .arrow {
    font-size: 10px;
    margin-left: 0.8em;
    color: var(--accent-orange);
}
.agg-cascade-menu > li:hover .arrow {
    color: #fff;
}
/* Grade submenu (A, B, C) */
.agg-cascade-menu .grade-submenu {
    display: none;
    position: absolute;
    left: 100%;
    top: 0;
    min-width: 80px;
    background: var(--surface-elevated);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    z-index: 101;
    margin: 0;
    padding: 0.3em 0;
    list-style: none;
}
.agg-cascade-menu > li.has-submenu:hover > .grade-submenu {
    display: block;
}
.agg-cascade-menu .grade-submenu > li {
    position: relative;
    padding: 0.5em 1em;
    cursor: pointer;
    font-size: 13px;
    color: var(--text-primary);
    white-space: nowrap;
    transition: background 0.12s;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.agg-cascade-menu .grade-submenu > li:hover {
    background: var(--accent-orange);
    color: #fff;
}
.agg-cascade-menu .grade-submenu > li .arrow {
    font-size: 10px;
    margin-left: 0.8em;
    color: var(--accent-orange);
}
.agg-cascade-menu .grade-submenu > li:hover .arrow {
    color: #fff;
}
/* Class submenu (1, 2, 3) */
.agg-cascade-menu .class-submenu {
    display: none;
    position: absolute;
    left: 100%;
    top: 0;
    min-width: 80px;
    background: var(--surface-elevated);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    z-index: 102;
    margin: 0;
    padding: 0.3em 0;
    list-style: none;
}
.agg-cascade-menu .grade-submenu > li.has-submenu:hover > .class-submenu {
    display: block;
}
.agg-cascade-menu .class-submenu > li {
    padding: 0.5em 1em;
    cursor: pointer;
    font-size: 13px;
    color: var(--text-primary);
    white-space: nowrap;
    transition: background 0.12s;
}
.agg-cascade-menu .class-submenu > li:hover {
    background: var(--accent-orange);
    color: #fff;
}

/* Inline submenu label (e.g. "Pump Height:", "Agg/Pipe Ratio:") */
.submenu-label {
    font-size: 11px;
    font-weight: 600;
    opacity: 0.85;
}

/* Pump ratio submenu items */
.pump-ratio-submenu {
    min-width: 90px !important;
}
.pump-ratio-item {
    padding: 0.5em 1em;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    color: var(--accent-orange);
    white-space: nowrap;
    transition: background 0.12s;
}
.pump-ratio-item:hover {
    background: var(--accent-orange);
    color: #fff;
}

/* ==========================================
   WATER CONTENT DROPDOWN
   ========================================== */
.water-content-dropdown {
    position: relative;
    display: block;
    width: 100%;
}

.water-content-btn {
    /* Match agg-cascade-btn styling exactly */
    padding: var(--space-sm) var(--space-md);
    background: var(--surface-panel);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: 13px;
    font-weight: 500;
    line-height: 1.4;
    transition: all var(--transition-base);
    width: 100%;
    box-sizing: border-box;
    text-align: left;
    cursor: pointer;
    appearance: none;
    outline: none;
    /* Dropdown arrow like select */
    background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' viewBox='0 0 12 8' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M2 2L6 6L10 2' stroke='%23999' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    padding-right: 30px;
}

.water-content-btn:hover,
.water-content-btn:focus {
    border-color: var(--accent-orange);
    box-shadow: 0 0 0 2px rgba(255, 107, 53, 0.15);
}

.water-content-dropdown.open .water-content-btn {
    border-color: var(--accent-orange);
    box-shadow: 0 0 0 3px rgba(255, 107, 53, 0.2);
}

.water-content-panel {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    min-width: 220px;
    background: var(--surface-elevated);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: 0 6px 20px rgba(0,0,0,0.2);
    z-index: 100;
    padding: 1em;
    margin-top: 4px;
}

.water-content-dropdown.open .water-content-panel {
    display: block;
}

.wc-input-row {
    display: flex;
    align-items: center;
    gap: 0.5em;
    margin-bottom: 0.8em;
}

.wc-input-row label {
    font-size: 12px;
    color: var(--text-secondary);
    min-width: 90px;
    white-space: nowrap;
}

.wc-input-row input {
    flex: 1;
    padding: 0.4em 0.6em;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 13px;
    background: var(--surface-base);
    color: var(--text-primary);
    width: 80px;
}

.wc-input-row input:focus {
    outline: none;
    border-color: var(--accent-orange);
}

.wc-result-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 0.8em;
    border-top: 1px solid var(--border-color);
    font-size: 13px;
}

.wc-result-row span {
    color: var(--text-secondary);
}

.wc-result-row strong {
    color: var(--accent-orange);
    font-size: 14px;
}

/* ==========================================
   CONCRETE MIX DESIGNER - ENHANCED EDITION
   Design: "Technical Precision"
   FIXED: Light theme input visibility
========================================== */

:root {
    /* Color System - Dark Theme */
    --app-zoom: 1.75;
    --primary-900: #0a1628;
    --primary-800: #132238;
    --primary-700: #1a2f48;
    --primary-600: #2d4263;
    --primary-500: #3d5a80;
    --accent-orange: #ff6b35;
    --accent-orange-hover: #ff8555;
    --accent-teal: #05dfd7;
    --accent-yellow: #ffd23f;
    --success: #00d4aa;
    --warning: #ffd23f;
    --error: #ff6b6b;
    --text-primary: #f6f9ff;
    --text-secondary: #cfd9e7;
    --text-tertiary: #a6b7cc;
    --surface-base: #0f1923;
    --surface-elevated: #1a2533;
    --surface-panel: #223242;
    --surface-overlay: rgba(34, 50, 66, 0.95);
    --border-color: rgba(123, 156, 197, 0.15);
    --border-accent: rgba(255, 107, 53, 0.3);
    
    /* Spacing */
    --space-xs: 0.25rem;
    --space-sm: 0.5rem;
    --space-md: 1rem;
    --space-lg: 1.5rem;
    --space-xl: 2rem;
    
    /* Animation */
    --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-base: 250ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-smooth: 350ms cubic-bezier(0.4, 0, 0.2, 1);
    
    /* Typography */
    --font-display: 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-mono: 'JetBrains Mono', 'Courier New', monospace;
}

/* Light Theme - FIXED FOR VISIBILITY */
html:not(.dark) {
    /* Light backgrounds */
    --surface-base: #f3f6f9;
    --surface-elevated: #ffffff;
    --surface-panel: #f8fafc;
    --surface-overlay: rgba(255, 255, 255, 0.95);
    
    /* Dark text for light theme */
    --text-primary: #1a2533;
    --text-secondary: #4a5568;
    --text-tertiary: #718096;
    
    /* Lighter borders */
    --border-color: rgba(45, 66, 99, 0.12);
    
    /* Adjust dark primary colors for light theme */
    --primary-700: #e2e8f0;
    --primary-600: #cbd5e0;
}

/* ==========================================
   GLOBAL RESET
========================================== */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html, body {
    height: 100vh;
    width: 100%;
    background: var(--surface-base);
    color: var(--text-primary);
    font-family: var(--font-display);
    font-weight: 400;
    line-height: 1.6;
    overflow: hidden;
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* Animated Background Grid */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: 
        linear-gradient(rgba(123, 156, 197, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(123, 156, 197, 0.03) 1px, transparent 1px);
    background-size: 30px 30px;
    pointer-events: none;
    z-index: 0;
    animation: gridPulse 20s ease-in-out infinite;
}

html:not(.dark) body::before {
    background-image: 
        linear-gradient(rgba(45, 66, 99, 0.05) 1px, transparent 1px),
        linear-gradient(90deg, rgba(45, 66, 99, 0.05) 1px, transparent 1px);
}

@keyframes gridPulse {
    0%, 100% { opacity: 0.3; }
    50% { opacity: 0.6; }
}

/* Radial Gradient Overlay */
body::after {
    content: '';
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 1200px;
    height: 1200px;
    background: radial-gradient(circle, rgba(255, 107, 53, 0.08) 0%, transparent 70%);
    pointer-events: none;
    z-index: 0;
    animation: float 15s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translate(-50%, -50%) scale(1); }
    50% { transform: translate(-50%, -50%) scale(1.1); }
}

/* ==========================================
   PAGE CONTAINER
========================================== */
.page-container {
    height: 100vh;
    width: 100%;
    display: flex;
    flex-direction: column;
    position: relative;
    z-index: 1;
    overflow: hidden;
    transform: scale(var(--app-zoom));
    transform-origin: top left;
    width: calc(100% / var(--app-zoom));
    height: calc(100% / var(--app-zoom));
}

/* ==========================================
   HEADER
========================================== */
.header-row {
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--surface-overlay);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border-color);
    padding: var(--space-sm) var(--space-lg);
    display: flex;
    align-items: center;
    justify-content: space-between;
    animation: slideDown 0.6s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

@keyframes slideDown {
    from {
        transform: translateY(-100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.header-row > div:first-child {
    font-size: 22px;
    font-weight: 700;
    letter-spacing: -0.5px;
    background: linear-gradient(135deg, var(--accent-orange), var(--accent-teal));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: 0 2px 10px rgba(255, 107, 53, 0.2);
}

.header-buttons {
    display: flex;
    gap: var(--space-sm);
    align-items: center;
}

.zoom-control {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    background: var(--surface-panel);
    border: 1px solid var(--border-color);
    border-radius: 10px;
}

.zoom-btn {
    width: 28px;
    height: 28px;
    display: grid;
    place-items: center;
    background: var(--surface-elevated);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: all var(--transition-base);
}

.zoom-btn:hover {
    border-color: var(--accent-orange);
    transform: translateY(-1px);
}

.zoom-display {
    min-width: 48px;
    text-align: center;
    font-weight: 700;
    color: var(--text-primary);
    font-size: 14px;
}

/* ==========================================
   DROPDOWNS
========================================== */
.dropdown {
    position: relative;
    display: inline-block;
}

.dropbtn {
    background: var(--surface-panel);
    color: var(--text-primary);
    padding: 10px 16px;
    font-size: 16px;
    font-weight: 600;
    border: 1px solid var(--border-color);
    cursor: pointer;
    border-radius: 8px;
    transition: all var(--transition-base);
    font-family: var(--font-display);
}

.dropbtn:hover {
    border-color: var(--accent-orange);
    background: var(--surface-elevated);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(255, 107, 53, 0.2);
}

.dropdown-content {
    display: none;
    position: absolute;
    right: 0;
    background: var(--surface-elevated);
    min-width: 100%;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    z-index: 1000;
    margin-top: 8px;
    font-size: 16px;
    overflow: hidden;
}

.dropdown:hover .dropdown-content,
.dropdown.open .dropdown-content {
    display: block;
    animation: dropdownFade 0.2s ease;
}

@keyframes dropdownFade {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.dropdown-content a {
    color: var(--text-primary);
    padding: 10px 16px;
    text-decoration: none;
    display: block;
    transition: background-color var(--transition-base);
    font-size: 16px;
    font-weight: 500;
}

.dropdown-content a:hover {
    background: var(--surface-panel);
}

.dropdown-content a.active {
    background: var(--accent-orange);
    color: white;
    font-weight: 700;
}

/* ==========================================
   CONTENT ROW - THREE COLUMNS
========================================== */
.content-row {
    flex: 1;
    display: grid;
    grid-template-columns: 240px auto 1fr 340px;
    gap: var(--space-sm);
    padding: var(--space-sm);
    position: relative;
    overflow: hidden;
    height: calc(100vh - 60px);
}

/* Allow grid children to shrink so their own overflow scrollbars work. */
.content-row > * {
    min-height: 0;
}

/* ==========================================
   LEFT COLUMN
========================================== */
.left-column {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
    animation: fadeInLeft 0.8s cubic-bezier(0.16, 1, 0.3, 1) 0.1s both;
    overflow-y: auto;
    overflow-x: hidden;
    scroll-behavior: smooth;
}

@keyframes fadeInLeft {
    from {
        opacity: 0;
        transform: translateX(-30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.standards-section,
.project-history,
.create-mixes {
    background: var(--surface-elevated);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: var(--space-sm) var(--space-md);
    position: relative;
    overflow: hidden;
    transition: all var(--transition-smooth);
}

.standards-section::before,
.project-history::before,
.create-mixes::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, var(--accent-orange), var(--accent-teal));
    opacity: 0;
    transition: opacity var(--transition-base);
}

.standards-section:hover::before,
.project-history:hover::before,
.create-mixes:hover::before {
    opacity: 1;
}

.standards-section h4,
.project-history h4,
.create-mixes h4 {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-tertiary);
    margin-bottom: var(--space-sm);
}

.standards-buttons {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.standards-buttons.compact {
    flex-direction: row;
    gap: 4px;
}

.standard-btn {
    padding: var(--space-sm);
    background: var(--surface-panel);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-family: var(--font-mono);
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-base);
    text-align: center;
}

.standards-buttons.compact .standard-btn {
    padding: 6px 10px;
    font-size: 12px;
}

.standard-btn:hover {
    border-color: var(--accent-orange);
    transform: translateX(4px);
}

.standard-btn.active {
    background: linear-gradient(135deg, var(--accent-orange), var(--accent-orange-hover));
    border-color: var(--accent-orange);
    color: white;
    box-shadow: 0 4px 12px rgba(255, 107, 53, 0.3);
}

.history-subtitle {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-tertiary);
    margin: var(--space-sm) 0 var(--space-xs);
}

#mix-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    min-height: 0;
    max-height: calc(100vh - 350px); /* Limit height to enable scrolling */
    padding-right: 4px; /* Space for scrollbar */
    scroll-behavior: smooth;
}

/* Custom scrollbar for mix list */
#mix-list::-webkit-scrollbar {
    width: 6px;
}

#mix-list::-webkit-scrollbar-track {
    background: var(--surface-panel);
    border-radius: 3px;
}

#mix-list::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 3px;
}

#mix-list::-webkit-scrollbar-thumb:hover {
    background: var(--accent-teal);
}

.mix-item {
    padding: var(--space-sm);
    background: var(--surface-panel);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    cursor: pointer;
    transition: all var(--transition-base);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 4px;
}

.mix-item:hover {
    background: var(--primary-700);
    border-color: var(--accent-orange);
    transform: translateX(4px);
}

.mix-item.active {
    background: var(--primary-600);
    border-color: var(--accent-orange);
    box-shadow: 0 0 0 2px rgba(255, 107, 53, 0.2);
}

.mix-name {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-primary);
    flex: 1;
}

.mix-standard {
    padding: 1px 6px;
    background: rgba(59, 130, 246, 0.15);
    border-radius: 4px;
    font-size: 10px;
    font-weight: 700;
    color: #3b82f6;
    letter-spacing: 0.3px;
}

.active-badge {
    padding: 2px 8px;
    background: rgba(255, 107, 53, 0.2);
    border-radius: 4px;
    font-size: 12px;
    font-weight: 700;
    color: var(--accent-orange);
    text-transform: uppercase;
}

.mix-actions {
    display: flex;
    gap: 4px;
}

.tiny-btn {
    padding: 2px 6px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background: var(--surface-elevated);
    font-size: 12px;
    cursor: pointer;
    transition: all var(--transition-base);
    color: var(--text-primary);
}

.tiny-btn:hover {
    border-color: var(--accent-orange);
    background: var(--surface-panel);
    transform: scale(1.1);
}

.tiny-btn.danger {
    border-color: var(--error);
    color: var(--error);
}

.secondary-btn {
    width: 100%;
    padding: var(--space-sm);
    background: var(--surface-panel);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-weight: 600;
    font-size: 12px;
    cursor: pointer;
    transition: all var(--transition-base);
    color: var(--text-primary);
    font-family: var(--font-display);
}

.secondary-btn:hover {
    border-color: var(--accent-teal);
    background: var(--primary-700);
    transform: translateY(-2px);
}

.create-mixes {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0; /* Important for flex children to shrink and scroll */
    overflow: hidden;
}

/* ==========================================
   RESIZE HANDLE
========================================== */
.resize-handle {
    width: 5px;
    cursor: col-resize;
    background: transparent;
    transition: background-color 0.2s;
    position: relative;
    margin: 0 -10px;
}

.resize-handle:hover::before {
    background: var(--accent-orange);
    height: 60px;
}

/* ==========================================
   MIDDLE COLUMN
========================================== */
.middle-column {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
    animation: fadeInUp 0.8s cubic-bezier(0.16, 1, 0.3, 1) 0.2s both;
    overflow-y: auto;
    overflow-x: hidden;
    scroll-behavior: smooth;
    min-height: 0; /* allow internal scroll instead of forcing parent overflow */
    height: 100%; /* fill grid track so scrollbar appears when zoomed */
    padding-right: 4px; /* keep scrollbar from overlaying content */
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.ai-input-area {
    background: var(--surface-elevated);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: var(--space-sm);
    box-shadow: 0 2px 8px rgba(5, 223, 215, 0.1);
    flex-shrink: 0; /* prevent collapsing when middle column scrolls */
}

.mode-note {
    font-size: 11px;
    font-weight: 500;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 2px;
}

.ai-input-form {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.ai-input-wrapper {
    position: relative;
}

#ai-input {
    width: 100%;
    padding: var(--space-sm);
    padding-bottom: 20px;
    background: var(--surface-panel);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    font-family: var(--font-display);
    font-size: 13px;
    resize: vertical;
    min-height: 40px;
    transition: all var(--transition-base);
    position: relative;
}

#ai-input:focus {
    outline: none;
    border-color: var(--accent-teal);
    box-shadow: 0 0 0 3px rgba(5, 223, 215, 0.1);
}

/* FIXED: Light theme focus state */
html:not(.dark) #ai-input:focus {
    background: var(--surface-elevated);
}

.ai-input-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--space-sm);
}

.option-toggle {
    display: inline-flex;
    background: var(--surface-panel);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 2px;
    gap: 2px;
}

.option-btn {
    padding: 5px 10px;
    background: transparent;
    border: none;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-base);
    font-family: var(--font-display);
}

.option-btn.active {
    background: var(--accent-teal);
    color: white;
    box-shadow: 0 2px 8px rgba(5, 223, 215, 0.3);
}

.ai-hint {
    font-size: 10px;
    color: var(--text-tertiary);
    position: absolute;
    bottom: 6px;
    left: 0;
    right: 0;
    padding: 0 var(--space-md);
    pointer-events: none;
}

.user-input-area {
    background: var(--surface-base);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
    flex: 1 1 auto; /* take remaining height in middle column */
    min-height: 0; /* allow internal scroll without pushing feedback away */
    overflow-y: auto; /* scroll the calculator contents when tall */
    padding-right: 4px; /* leave room for scrollbar without covering inputs */
}

.calculator-header {
    padding: var(--space-xs) var(--space-md);
    background: linear-gradient(135deg, var(--primary-700), var(--primary-600));
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--space-sm);
}

/* FIXED: Light theme calculator header */
html:not(.dark) .calculator-header {
    background: linear-gradient(135deg, #e2e8f0, #cbd5e0);
}

.calculator-header h3 {
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 0;
    color: var(--text-primary);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.header-actions .calculate-btn {
    padding: 8px 16px;
    font-size: 14px;
    white-space: nowrap;
}

.header-actions .export-dropdown-wrapper {
    position: relative;
}

.header-actions .export-dropdown-btn {
    padding: 8px 14px;
    font-size: 14px;
}

.unit-toggle {
    display: inline-flex;
    background: var(--surface-panel);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 2px;
    gap: 2px;
}

.unit-btn {
    padding: 6px 10px;
    background: transparent;
    border: none;
    border-radius: 5px;
    font-family: var(--font-mono);
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-base);
}

.unit-btn.active {
    background: var(--accent-orange);
    color: white;
    box-shadow: 0 2px 8px rgba(255, 107, 53, 0.3);
}

/* ==========================================
   FORM STYLES - FIXED FOR LIGHT THEME
========================================== */
#mix-form {
    padding: var(--space-md) var(--space-lg);
}

.form-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: var(--space-md);
    margin-bottom: var(--space-sm);
}

.form-row.tight {
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: var(--space-sm);
    margin-bottom: var(--space-sm);
}

.form-row.split {
    grid-template-columns: repeat(2, 1fr);
}

.form-row.additive-row {
    grid-template-columns: 1fr 1fr;
    gap: var(--space-md);
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.form-group label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    color: var(--text-secondary);
}

/* Key parameters - orange highlight */
.form-group label.key-param {
    color: var(--accent-orange);
}

.slump-inline {
    display: flex;
    gap: var(--space-sm);
    align-items: flex-end;
}

.slump-range {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 140px;
}

.slump-range select {
    padding: var(--space-sm) var(--space-md);
    background: var(--surface-panel);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: 18px;
    font-weight: 500;
    width: 100%;
    box-sizing: border-box;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' viewBox='0 0 12 8' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M2 2L6 6L10 2' stroke='%23999' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.7em center;
    background-size: 0.8em;
    padding-right: 2em;
}

.slump-range-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-tertiary);
}

/* FIXED: Placeholder visibility in both themes */
.form-group input::placeholder,
.form-group select::placeholder,
textarea::placeholder {
    color: var(--text-tertiary);
    opacity: 0.7;
}

.form-group input[type="number"],
.form-group select {
    padding: var(--space-sm) var(--space-md);
    background: var(--surface-panel);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: 13px;
    font-weight: 500;
    line-height: 1.4;
    transition: all var(--transition-base);
    width: 100%;
    box-sizing: border-box;
}

.form-group select {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    cursor: pointer;
    text-align: left;
    background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' viewBox='0 0 12 8' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M2 2L6 6L10 2' stroke='%23999' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.7em center;
    background-size: 0.8em;
    padding-right: 2em;
}

/* FIXED: Light theme focus states */
.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--accent-orange);
    box-shadow: 0 0 0 3px rgba(255, 107, 53, 0.1);
}

html:not(.dark) .form-group input:focus,
html:not(.dark) .form-group select:focus {
    background: var(--surface-elevated);
}

/* Inline form group for checkboxes */
.form-group-inline {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 4px;
}

.checkbox-label {
    font-size: 11px;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
}

.form-group-inline input[type="checkbox"] {
    width: 12px;
    height: 12px;
    accent-color: var(--accent-orange);
}

/* Disabled select options styling */
.form-group select option:disabled {
    color: var(--text-tertiary);
    background: var(--surface-panel);
    opacity: 0.5;
}

/* Water-Binding Ratio Combined Input */
.wb-ratio-wrapper {
    position: relative;
    width: 100%;
}

.wb-ratio-wrapper select {
    width: 100%;
}

.wb-ratio-wrapper .hidden {
    display: none !important;
}

.wb-custom-input-wrapper {
    display: flex;
    align-items: center;
    gap: 4px;
    width: 100%;
}

.wb-ratio-input {
    flex: 1;
    padding: var(--space-sm) var(--space-md);
    background: var(--surface-panel);
    border: 1px solid var(--border-color);
    border-radius: 6px;
}

.wb-dropdown-toggle:hover {
    border-color: var(--accent-orange);
    color: var(--accent-orange);
    background: var(--surface-elevated);
}

html:not(.dark) .wb-ratio-input {
    background: #ffffff;
}

html:not(.dark) .wb-dropdown-toggle {
    background: #ffffff;
}

/* Slump Combined Input (same pattern as W/B Ratio) */
.slump-wrapper {
    position: relative;
    width: 100%;
}

.slump-wrapper select {
    width: 100%;
}

.slump-wrapper .hidden {
    display: none !important;
}

.slump-custom-input-wrapper {
    display: flex;
    align-items: center;
    gap: 2px;
    width: 100%;
}

.slump-input {
    flex: 1;
    min-width: 0;
    padding: var(--space-sm) var(--space-sm);
    background: var(--surface-panel);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: 13px;
    font-weight: 500;
    transition: all var(--transition-base);
}

.slump-input:focus {
    outline: none;
    border-color: var(--accent-orange);
    box-shadow: 0 0 0 3px rgba(255, 107, 53, 0.1);
}

.slump-dropdown-toggle {
    padding: 3px 5px;
    background: var(--surface-panel);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    color: var(--text-secondary);
    font-size: 9px;
    line-height: 1;
    cursor: pointer;
    transition: all var(--transition-base);
    flex-shrink: 0;
}

.slump-dropdown-toggle:hover {
    border-color: var(--accent-orange);
    color: var(--accent-orange);
    background: var(--surface-elevated);
}

html:not(.dark) .slump-input {
    background: #ffffff;
}

html:not(.dark) .slump-dropdown-toggle {
    background: #ffffff;
}

/* === Slump Cascade Menu (same pattern as Aggregate cascade) === */
.slump-cascade-menu {
    display: none;
    position: absolute;
    left: 0;
    top: 100%;
    width: 100%;
    min-width: 0;
    background: var(--surface-elevated);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    z-index: 100;
    margin: 2px 0 0 0;
    padding: 0.3em 0;
    list-style: none;
}
.slump-wrapper.open > .slump-cascade-menu {
    display: block;
}
.slump-cascade-menu > li {
    position: relative;
    padding: 0.5em 1em;
    cursor: pointer;
    font-size: 13px;
    color: var(--text-primary);
    white-space: nowrap;
    transition: background 0.12s;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.slump-cascade-menu > li:hover {
    background: var(--accent-orange);
    color: #fff;
}
.slump-cascade-menu > li .arrow {
    font-size: 10px;
    margin-left: 0.8em;
    color: var(--accent-orange);
}
.slump-cascade-menu > li:hover .arrow {
    color: #fff;
}
/* Slump sub-menus (right flyout 鈥?shared by Vebe & Plastic) */
.slump-submenu {
    display: none;
    position: absolute;
    left: 100%;
    top: 0;
    min-width: 110px;
    background: var(--surface-elevated);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    z-index: 101;
    margin: 0;
    padding: 0.3em 0;
    list-style: none;
}
.slump-cascade-menu > li.has-submenu:hover > .slump-submenu {
    display: block;
}
.slump-submenu > li {
    padding: 0.5em 1em;
    cursor: pointer;
    font-size: 13px;
    color: var(--text-primary);
    white-space: nowrap;
    transition: background 0.12s;
}
.slump-submenu > li:hover {
    background: var(--accent-orange);
    color: #fff;
}

/* Field Warning (red reminder text - inside input field) */
.field-warning-inline {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 10px;
    color: #ef4444;
    background: transparent;
    font-weight: 700;
    white-space: nowrap;
    pointer-events: none;
    z-index: 1;
    text-shadow: 0 0 2px rgba(255,255,255,0.8);
    animation: blink-warning 0.5s ease-in-out 3;
}

.field-warning-inline.hidden {
    display: none !important;
}

.wb-ratio-input {
    padding-right: 60px !important;
}

@keyframes blink-warning {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

.wb-input-container {
    position: relative;
    flex: 1;
}

.wb-input-container .wb-ratio-input {
    width: 100%;
}

.form-hint {
    font-size: 12px;
    color: var(--text-tertiary);
    margin-top: -4px;
}

/* ==========================================
   ADDITIVES - LIST LAYOUT
========================================== */
.additive-list-header {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 2px 6px 2px 6px;
    border-bottom: 1px solid var(--border-accent);
    margin-bottom: 1px;
    min-width: 0;
}

.additive-name-col {
    flex: 1;
    font-size: 10px;
    font-weight: 600;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

.additive-rate-col {
    min-width: 36px;
    width: 36px;
    max-width: 60px;
    font-size: 10px;
    font-weight: 700;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.4px;
    text-align: left;
    display: inline-block;
    margin-left: 0;
    padding-left: 0;
    padding-right: 0;
}

.additive-dosage-col {
    width: 100px;
    font-size: 10px;
    font-weight: 700;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.4px;
    text-align: center;
}

.additive-limit-col {
    width: 50px;
    font-size: 10px;
    font-weight: 700;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.4px;
    text-align: center;
}

.mineral-limit-label {
    display: inline-block;
    width: 50px;
    min-width: 40px;
    text-align: center;
    font-size: 11px;
    font-weight: 600;
    color: var(--accent-blue, #2196F3);
    white-space: nowrap;
}

.additive-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.additive-list.compact {
    gap: 1px;
}

.additive-list-item.compact {
    display: flex;
    align-items: center;
    padding: 1px 4px;
    gap: 4px;
    background: transparent;
    border: 1px dashed var(--border-color);
    border-radius: 6px;
    min-width: 0;
}
/* Ensure mineral and chemical additive lists are horizontally aligned */
.additive-list-header,
.additive-list.compact {
    width: 100%;
    min-width: 0;
}
.additive-list-item.compact > .additive-name-col,
.additive-list-item.compact > .additive-type-col,
.additive-list-item.compact > .additive-dosage-col {
    min-width: 0;
}
.additive-list-header .additive-name-col,
.additive-list-item.compact .additive-name-col {
    flex: 1 1 0;
    min-width: 0;
}
.additive-list-header .additive-type-col,
.additive-list-item.compact .additive-type-col {
    min-width: 36px;
    width: 36px;
    max-width: 60px;
    text-align: left;
    display: inline-block;
    margin-left: 0;
    padding-left: 0;
    padding-right: 0;
}
.additive-list-header .additive-dosage-col,
.additive-list-item.compact .additive-dosage-col {
    width: 100px;
    min-width: 60px;
    text-align: center;
    margin-left: auto;
}

.additive-chip {
    flex: 1;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    background: var(--surface-panel);
    border: 1px solid var(--border-color);
    border-radius: 999px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
    line-height: 1.2;
    cursor: pointer;
    transition: all var(--transition-base);
    min-height: 22px;
}

.additive-chip:hover {
    border-color: var(--accent-orange);
    background: var(--surface-elevated);
    transform: translateY(-1px);
}

.additive-list-item.compact input[type="checkbox"] {
    width: 10px;
    height: 11px;
}

.additive-list-item.compact .dosage-input-list,
.additive-list-item.compact .rate-input-list {
    width: 50px;
    padding: 3px 6px;
    font-size: 11px;
}

.rate-label {
    font-size: 10px;
    font-weight: 600;
    color: var(--text-tertiary);
    flex-shrink: 0;
    margin-left: 2px;
}

.dosage-label {
    font-size: 10px;
    font-weight: 600;
    color: var(--text-tertiary);
    flex-shrink: 0;
    margin-left: 2px;
}

.input-with-suffix {
    display: inline-flex;
    align-items: center;
    justify-content: flex-start;
    position: relative;
    gap: 6px;
    width: auto;
    flex-shrink: 0;
}

.input-with-suffix .field-label {
    font-size: 11px;
    font-weight: 700;
    color: var(--text-secondary);
    white-space: nowrap;
}

.input-with-suffix .input-wrapper {
    position: relative;
    display: inline-flex;
    align-items: center;
}

.input-with-suffix input {
    width: 50px;
    padding-right: 18px;
}

.input-with-suffix .input-suffix {
    position: absolute;
    right: 4px;
    font-size: 10px;
    font-weight: 600;
    color: var(--text-tertiary);
    pointer-events: none;
}


.additive-group-title {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-tertiary);
    letter-spacing: 0.5px;
    text-transform: uppercase;
    padding: 2px 4px;
}

.additive-list-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 10px;
    background: var(--surface-panel);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    transition: all var(--transition-base);
}

.additive-list-item:hover {
    border-color: var(--accent-teal);
    background: var(--surface-elevated);
}

.additive-list-item label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    cursor: pointer;
    flex: 1;
}

.additive-list-item input[type="checkbox"] {
    width: 10px;
    height: 16px;
    accent-color: var(--accent-teal);
    cursor: pointer;
    flex-shrink: 0;
}

.additive-list-item input[type="checkbox"]:checked {
    accent-color: var(--accent-orange);
}

.dosage-input-list {
    width: 120px;
    padding: 6px 10px;
    background: var(--surface-base);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: 12px;
    flex-shrink: 0;
    transition: all var(--transition-base);
}

.dosage-input-list:focus {
    outline: none;
    border-color: var(--accent-orange);
    background: var(--surface-elevated);
}

.dosage-input-list:disabled,
.rate-input-list:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* FIXED: Light theme dosage input */
html:not(.dark) .dosage-input-list,
html:not(.dark) .rate-input-list {
    background: #ffffff;
}

.dosage-input:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.dosage-input:focus {
    outline: none;
    border-color: var(--accent-teal);
}

/* ==========================================
   BUTTONS
========================================== */
.button-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--space-md);
    margin-top: var(--space-xl);
    padding-top: var(--space-lg);
    border-top: 1px solid var(--border-color);
}

.button-row > div:first-child {
    display: flex;
    gap: var(--space-sm);
}

.calculate-btn {
    padding: var(--space-sm) var(--space-lg);
    background: linear-gradient(135deg, var(--accent-orange), var(--accent-orange-hover));
    border: none;
    border-radius: 6px;
    color: white;
    font-family: var(--font-display);
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    transition: all var(--transition-base);
    box-shadow: 0 2px 8px rgba(255, 107, 53, 0.3);
    position: relative;
    overflow: hidden;
}

.calculate-btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.calculate-btn:hover::before {
    width: 300px;
    height: 300px;
}

.calculate-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 107, 53, 0.5);
}

.calculate-btn.primary {
    background: var(--success);
}

.export-dropdown-wrapper {
    position: relative;
}

.export-dropdown-btn {
    padding: var(--space-sm) var(--space-md);
    background: var(--surface-panel);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-base);
    font-family: var(--font-display);
}

.export-dropdown-btn:hover {
    border-color: var(--accent-orange);
}

/* FIXED: Light theme hover */
html:not(.dark) .export-dropdown-btn:hover {
    background: var(--surface-elevated);
}

.export-dropdown-menu {
    display: none;
    position: absolute;
    right: 0;
    bottom: 100%;
    margin-bottom: 8px;
    background: var(--surface-elevated);
    min-width: 140px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden;
    z-index: 100;
}

.export-dropdown-wrapper:hover .export-dropdown-menu,
.export-dropdown-wrapper.open .export-dropdown-menu {
    display: block;
}

.export-dropdown-menu a {
    display: block;
    padding: 10px 14px;
    color: var(--text-primary);
    text-decoration: none;
    font-size: 13px;
    transition: background var(--transition-base);
}

.export-dropdown-menu a:hover {
    background: var(--surface-panel);
}

/* Action Buttons Row */
.action-buttons-row {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-md);
    background: var(--surface-panel);
    border-top: 1px solid var(--border-color);
    margin-top: 0;
}

.action-buttons-row .calculate-btn {
    flex: 1;
    min-width: 0;
    padding: 8px 12px;
    font-size: 13px;
    white-space: nowrap;
}

.action-buttons-row .export-dropdown-wrapper {
    position: relative;
    flex: 1;
    min-width: 0;
}

.action-buttons-row .export-dropdown-btn {
    width: 100%;
    padding: 8px 12px;
    font-size: 13px;
    white-space: nowrap;
}

.system-feedback {
    background: var(--surface-elevated);
    border: 1px solid var(--border-color);
    border-left: 4px solid var(--warning);
    border-radius: 8px;
    padding: var(--space-sm);
    font-size: 12px;
    color: var(--text-secondary);
    transition: all var(--transition-base);
    flex-shrink: 0; /* keep feedback visible; let calculator scroll instead */
}

/* ==========================================
   RIGHT COLUMN
========================================== */
.right-column {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
    animation: fadeInRight 0.8s cubic-bezier(0.16, 1, 0.3, 1) 0.3s both;
    overflow-y: auto;
    overflow-x: hidden;
    scroll-behavior: smooth;
}

@keyframes fadeInRight {
    from {
        opacity: 0;
        transform: translateX(30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.main-menu {
    background: var(--surface-elevated);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: var(--space-sm) var(--space-md);
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-tertiary);
}

.tab-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 4px;
    margin-top: var(--space-sm);
}

.tab {
    padding: var(--space-sm);
    background: var(--surface-panel);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-base);
    text-align: center;
    font-family: var(--font-display);
}

.tab:hover {
    border-color: var(--accent-orange);
    transform: translateY(-2px);
    box-shadow: 0 2px 8px rgba(255, 107, 53, 0.2);
}

.tab.active {
    background: var(--accent-orange);
    border-color: var(--accent-orange);
    color: white;
    box-shadow: 0 4px 12px rgba(255, 107, 53, 0.3);
}

.chart-display,
.mix-result {
    background: var(--surface-elevated);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: var(--space-sm) var(--space-md);
    min-height: 120px;
    flex: 1;
}

.chart-display h4,
.mix-result h4 {
    font-size: 12px;
    font-weight: 700;
    margin-bottom: var(--space-sm);
    color: var(--text-primary);
    padding-bottom: 4px;
    border-bottom: 1px solid var(--border-color);
}

#results {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.result-item {
    padding: var(--space-sm);
    background: var(--surface-panel);
    border-left: 3px solid var(--accent-orange);
    border-radius: 6px;
    display: flex;
    justify-content: space-between;
    transition: all var(--transition-base);
}

.result-item:hover {
    transform: translateX(4px);
    box-shadow: 0 2px 8px rgba(255, 107, 53, 0.1);
}

/* FIXED: Light theme result hover */
html:not(.dark) .result-item:hover {
    background: var(--surface-elevated);
}

/* Calculation Steps Button */
.calc-steps-btn {
    width: 100%;
    padding: var(--space-sm) var(--space-md);
    background: var(--accent-orange);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-base);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.strength-btn {
    padding: 0.5em 1em;
    background: var(--accent-orange);
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 0.9em;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-base);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    white-space: nowrap;
}

.strength-btn:hover {
    background: var(--accent-orange-hover);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(255, 107, 53, 0.3);
}

.calc-steps-btn:hover {
    background: var(--accent-orange-hover);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(255, 107, 53, 0.3);
}

.calc-steps-btn #btn-icon {
    font-size: 12px;
    transition: transform 0.3s ease;
}

.calc-steps-btn.expanded #btn-icon {
    transform: rotate(180deg);
}

/* Calculation Steps Container */
.calculation-steps {
    margin-top: 1em;
    padding: var(--space-md);
    background: var(--surface-panel);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    max-height: 600px;
    overflow-y: auto;
}

.step-box {
    background: var(--surface-elevated);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: var(--space-md);
    margin-bottom: var(--space-md);
}

.step-box:last-child {
    margin-bottom: 0;
}

.step-header {
    font-size: 14px;
    font-weight: 700;
    color: var(--accent-orange);
    margin-bottom: var(--space-sm);
    padding-bottom: var(--space-xs);
    border-bottom: 2px solid var(--accent-orange);
}

.step-content {
    font-size: 13px;
    line-height: 1.6;
}

.step-item {
    padding: 6px 0;
    display: flex;
    justify-content: space-between;
    border-bottom: 1px solid var(--border-color);
}

.step-item:last-child {
    border-bottom: none;
}

.step-label {
    font-weight: 600;
    color: var(--text-primary);
}

.step-value {
    color: var(--text-secondary);
    font-family: 'Courier New', monospace;
}

.step-formula {
    background: rgba(255, 107, 53, 0.1);
    padding: 8px 12px;
    border-left: 3px solid var(--accent-orange);
    border-radius: 4px;
    margin: 8px 0;
    font-family: 'Courier New', monospace;
    font-size: 12px;
}

.step-result {
    background: rgba(76, 175, 80, 0.1);
    padding: 8px 12px;
    border-left: 3px solid #4caf50;
    border-radius: 4px;
    margin: 8px 0;
    font-weight: 600;
}

.step-warning {
    background: rgba(255, 193, 7, 0.1);
    padding: 8px 12px;
    border-left: 3px solid #ffc107;
    border-radius: 4px;
    margin: 8px 0;
    color: #f57c00;
}

.step-ok {
    color: #4caf50;
    font-weight: 600;
}

.step-fail {
    color: #f44336;
    font-weight: 600;
}

.result-item strong {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ==========================================
   STRENGTH RESULT MODAL
========================================== */
.strength-result-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    animation: fadeIn 0.2s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.strength-result-content {
    background: var(--surface-panel);
    border-radius: 8px;
    padding: 2em;
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
    animation: slideUp 0.3s ease-out;
}

@keyframes slideUp {
    from {
        transform: translateY(20px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.strength-result-content h3 {
    color: var(--accent-orange);
    font-size: 1.3em;
    margin: 0 0 1em 0;
    border-bottom: 2px solid var(--accent-orange);
    padding-bottom: 0.5em;
}

.strength-box {
    background: var(--surface-elevated);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 1.5em;
    margin-bottom: 1em;
}

.strength-box h4 {
    color: var(--text-primary);
    font-size: 1em;
    margin: 0 0 1em 0;
    padding-bottom: 0.5em;
    border-bottom: 1px solid var(--border-color);
}

.strength-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.8em 0;
    border-bottom: 1px solid var(--border-color);
}

.strength-item:last-child {
    border-bottom: none;
}

.strength-item label {
    font-weight: 600;
    color: var(--text-secondary);
    margin: 0;
}

.strength-value {
    font-family: 'Courier New', monospace;
    font-weight: 600;
    color: var(--text-primary);
    font-size: 1.1em;
}

.strength-value.highlight {
    color: var(--accent-orange);
    font-size: 1.2em;
    background: rgba(255, 107, 53, 0.1);
    padding: 0.3em 0.6em;
    border-radius: 4px;
}

.strength-formula {
    background: rgba(255, 107, 53, 0.1);
    padding: 1em;
    border-left: 3px solid var(--accent-orange);
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-size: 0.95em;
    color: var(--text-primary);
    margin: 1em 0;
}

/* ==========================================
   DESIGN MANUAL MODAL
========================================== */
.design-manual-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1001;
    animation: fadeIn 0.2s ease-out;
    padding: 20px;
}

.design-manual-container {
    width: 100%;
    background: white;
    border-radius: 0;
    overflow-y: auto;
    color: #333;
    font-family: 'Arial', sans-serif;
    animation: slideDown 0.3s ease-out;
    margin-top: 1em;
}

.design-manual-view {
    width: 100%;
}

.design-manual-view .design-manual-header {
    text-align: center;
    border-bottom: 3px solid #FF6B35;
    padding: 1.5em 0 1.5em 0;
    margin-bottom: 0;
}

.design-manual-view .design-manual-header h1 {
    color: #FF6B35;
    font-size: 1.8em;
    margin: 0 0 0.5em 0;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.design-manual-view .design-manual-header p {
    color: #666;
    margin: 0.3em 0;
    font-size: 0.95em;
}

.design-manual-view .manual-controls {
    position: sticky;
    top: 0;
    display: flex;
    gap: 10px;
    padding: 1em 3em;
    background: white;
    border-bottom: 2px solid #f0f0f0;
    z-index: 10;
    flex-wrap: wrap;
    margin: 0;
}

.design-manual-view .manual-btn {
    background: #FF6B35;
    color: white;
    border: none;
    padding: 0.5em 1em;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9em;
    font-weight: 600;
    transition: all 0.2s;
}

.design-manual-view .manual-btn:hover {
    background: #E55A25;
    transform: translateY(-2px);
}

.design-manual-content {
    background: white;
    border-radius: 8px;
    padding: 0;
    max-width: 1200px;
    width: 95%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    animation: slideUp 0.3s ease-out;
    color: #333;
    font-family: 'Arial', sans-serif;
    position: relative;
    transition: max-width 0.3s ease, width 0.3s ease;
    display: flex;
    flex-direction: column;
}

.design-manual-content.expanded {
    max-width: 90vw;
    width: 90vw;
}

.design-manual-header {
    text-align: center;
    border-bottom: 3px solid #FF6B35;
    padding-bottom: 1.5em;
    margin-bottom: 2em;
}

.design-manual-header h1 {
    color: #FF6B35;
    font-size: 1.8em;
    margin: 0 0 0.5em 0;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.design-manual-header p {
    color: #666;
    margin: 0.3em 0;
    font-size: 0.95em;
}

.manual-controls {
    position: sticky;
    top: 0;
    display: flex;
    gap: 10px;
    padding: 1em 3em;
    background: white;
    border-bottom: 2px solid #f0f0f0;
    z-index: 10;
    flex-wrap: wrap;
    margin: 0;
}

/* Composite additive row */
.composite-row {
    display: flex;
    align-items: center;
    gap: 0.35em;
    margin-bottom: 0.2em;
}
.composite-btn {
    background: #FF6B35;
    color: white;
    border: none;
    padding: 0.15em 0.5em;
    border-radius: 3px;
    cursor: pointer;
    font-size: 0.72em;
    font-weight: 600;
    line-height: 1.3;
    transition: all 0.15s;
    white-space: nowrap;
}
.composite-btn:hover {
    background: #E55A25;
}
.composite-btn:disabled {
    opacity: 0.4;
    cursor: default;
}
.composite-display {
    font-size: 0.72em;
    color: var(--text-secondary, #555);
    white-space: nowrap;
}

.manual-btn {
    background: #FF6B35;
    color: white;
    border: none;
    padding: 0.5em 1em;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9em;
    font-weight: 600;
    transition: all 0.2s;
}

.manual-btn:hover {
    background: #E55A25;
    transform: translateY(-2px);
}

.manual-btn.primary {
    background: linear-gradient(135deg, #FF6B35 0%, #E55A25 100%);
    font-weight: bold;
    padding: 0.6em 1.5em;
    font-size: 1em;
    box-shadow: 0 2px 8px rgba(255, 107, 53, 0.3);
}

.manual-btn.primary:hover {
    background: linear-gradient(135deg, #E55A25 0%, #d04a15 100%);
    box-shadow: 0 4px 12px rgba(255, 107, 53, 0.4);
}

.manual-btn.close {
    background: #999;
    padding: 0.3em 0.8em;
    font-size: 1.2em;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.manual-btn.close:hover {
    background: #777;
}

.manual-section {
    background: #f9f9f9;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 1.5em;
    margin: 1.5em 0;
    page-break-inside: avoid;
}

.manual-section h2 {
    color: #FF6B35;
    font-size: 1.2em;
    margin: 0 0 1em 0;
    padding-bottom: 0.5em;
    border-bottom: 2px solid #FF6B35;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    user-select: none;
    transition: all 0.3s ease;
}

.manual-section h2:hover {
    background: rgba(255, 107, 53, 0.05);
    padding: 0.3em;
    margin: -0.3em 0 1em -0.3em;
    border-radius: 4px;
}

.section-toggle {
    font-size: 1.2em;
    transition: transform 0.3s ease;
    display: inline-block;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.manual-section.collapsed h2 .section-toggle {
    transform: rotate(-90deg);
}

.section-content {
    max-height: 2000px;
    overflow: hidden;
    transition: max-height 0.3s ease, opacity 0.3s ease;
    opacity: 1;
}

.manual-section.collapsed .section-content {
    max-height: 0;
    opacity: 0;
}

.manual-section h3 {
    color: #333;
    font-size: 1em;
    margin: 1.5em 0 0.8em 0;
    font-weight: bold;
}

.input-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1em;
    margin: 1em 0;
}

.input-item {
    background: white;
    padding: 0.8em;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.input-label {
    font-weight: bold;
    color: #555;
    font-size: 0.9em;
    display: block;
    margin-bottom: 0.3em;
}

.input-value {
    color: #FF6B35;
    font-family: 'Courier New', monospace;
    font-size: 1.1em;
    font-weight: bold;
}

.formula-box {
    background: #E3F2FD;
    border-left: 4px solid #2196F3;
    padding: 1.2em;
    margin: 1em 0;
    font-family: 'Courier New', monospace;
    line-height: 1.8;
    font-size: 0.95em;
    page-break-inside: avoid;
}

.formula-box strong {
    color: #1976D2;
    font-size: 1.05em;
}

.result-box {
    background: #E8F5E9;
    border-left: 4px solid #4CAF50;
    padding: 1.2em;
    margin: 1em 0;
    font-weight: 600;
    color: #2E7D32;
    page-break-inside: avoid;
}

.condition-box {
    background: #FFF3E0;
    border-left: 4px solid #FF9800;
    padding: 1em;
    margin: 1em 0;
    font-size: 0.95em;
    color: #E65100;
}

.given-box {
    background: #F5F5F5;
    border: 2px solid #333;
    border-radius: 4px;
    padding: 1.5em;
    margin: 1em 0;
    font-family: 'Arial', sans-serif;
    font-size: 0.95em;
    color: #333;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    column-count: 3;
    column-gap: 1.5em;
    column-rule: 1px solid #ddd;
}

.given-box .input-item {
    break-inside: avoid;
    page-break-inside: avoid;
    line-height: 2.2;
    padding: 2px 0;
}

.step-divider {
    border-top: 2px solid #FF6B35;
    margin: 2em 0;
    page-break-before: always;
}

.final-result {
    background: #FFFDE7;
    border: 2px solid #FBC02D;
    border-radius: 4px;
    padding: 2em;
    margin: 2em 0;
    text-align: center;
    page-break-inside: avoid;
}

.final-result h2 {
    color: #F57F17;
    margin-top: 0;
}

.final-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 1em;
    margin: 1.5em 0;
}

.final-item {
    background: white;
    padding: 1em;
    border: 1px solid #FBC02D;
    border-radius: 4px;
    text-align: center;
}

.final-item-label {
    color: #666;
    font-size: 0.9em;
    margin-bottom: 0.5em;
}

.final-item-value {
    color: #F57F17;
    font-family: 'Courier New', monospace;
    font-weight: bold;
    font-size: 1.2em;
}

@media print {
    .design-manual-modal {
        background: white;
        padding: 0;
    }
    
    .design-manual-content {
        max-width: 100%;
        max-height: 100%;
        box-shadow: none;
        border-radius: 0;
        padding: 2em;
    }
    
    .manual-controls {
        display: none;
    }
    
    .step-divider {
        page-break-before: always;
    }
}

/* ==========================================
   RESPONSIVE
========================================== */
@media (max-width: 1600px) {
    .content-row {
        grid-template-columns: 240px auto 1fr 320px;
    }
}

@media (max-width: 1200px) {
    .content-row {
        grid-template-columns: 1fr;
    }
    
    .resize-handle {
        display: none;
    }
    
    .form-row {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .tab-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .header-row {
        padding: var(--space-md);
    }
    
    .header-row > div:first-child {
        font-size: 20px;
    }
    
    .content-row {
        padding: var(--space-md);
    }
}

/* ==========================================
   SCROLLBAR
========================================== */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: var(--surface-base);
}

::-webkit-scrollbar-thumb {
    background: var(--primary-600);
    border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--primary-500);
}

/* Light theme scrollbar */
html:not(.dark) ::-webkit-scrollbar-thumb {
    background: #cbd5e0;
}

html:not(.dark) ::-webkit-scrollbar-thumb:hover {
    background: #a0aec0;
}

/* ==========================================
   UTILITY CLASSES
========================================== */
.panel-hidden {
    display: none !important;
}

.visually-hidden {
    position: absolute;
    height: 1px;
    width: 1px;
    overflow: hidden;
    clip: rect(1px, 1px, 1px, 1px);
    white-space: nowrap;
}

/* ==========================================
   LOADING STATES
========================================== */
@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 0.8s linear infinite;
}

/* ==========================================
   ENHANCED INTERACTIONS
========================================== */
button,
.dropbtn,
.tab,
.standard-btn,
.mix-item {
    position: relative;
}

button:active,
.dropbtn:active,
.tab:active,
.standard-btn:active {
    transform: scale(0.98);
}

/* Focus states for accessibility */
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
    outline: 2px solid var(--accent-orange);
    outline-offset: 2px;
}

/* ==========================================
   PRINT STYLES - Exact match to Design Manual
========================================== */
@media print {
    /* Print with exact colors as displayed */
    * {
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }
    
    /* Reset body and html for print */
    html, body {
        width: 100% !important;
        height: auto !important;
        margin: 0 !important;
        padding: 0 !important;
        background: white !important;
        overflow: visible !important;
        font-size: 11pt !important;
    }
    
    /* Hide non-essential UI elements */
    .header-row,
    .header-buttons,
    .resize-handle,
    .system-feedback,
    .left-column,
    .right-column,
    .user-input-area,
    .ai-input-area,
    .manual-controls,
    .manual-btn,
    nav,
    footer,
    .dropdown,
    .profile-dropdown,
    .theme-dropdown,
    .lang-dropdown,
    #export-btn,
    .export-dropdown-wrapper,
    .action-buttons-row,
    .calculator-header,
    .standards-section,
    .project-history,
    .main-menu,
    .chart-display,
    .mix-result,
    .strength-result-modal,
    .design-manual-modal,
    .section-toggle,
    .zoom-control {
        display: none !important;
    }
    
    /* Make containers visible and full width */
    .page-container,
    .content-row,
    .middle-column {
        display: block !important;
        width: 100% !important;
        height: auto !important;
        margin: 0 !important;
        padding: 0 !important;
        background: white !important;
        overflow: visible !important;
        position: static !important;
        flex: none !important;
    }
    
    /* Show design manual container - EXACT as screen */
    #design-manual-container,
    .design-manual-container,
    .design-manual-view {
        display: block !important;
        position: static !important;
        width: 100% !important;
        height: auto !important;
        max-height: none !important;
        background: white !important;
        padding: 0 !important;
        margin: 0 !important;
        overflow: visible !important;
        box-shadow: none !important;
    }
    
    /* Design manual content - preserve styling */
    .design-manual-content {
        max-width: 100% !important;
        width: 100% !important;
        max-height: none !important;
        overflow: visible !important;
        box-shadow: none !important;
        padding: 0.4in !important;
        margin: 0 !important;
        background: white !important;
    }
    
    /* Ensure all sections are expanded for print */
    .section-content {
        display: block !important;
        max-height: none !important;
        opacity: 1 !important;
        overflow: visible !important;
    }
    
    .manual-section.collapsed .section-content {
        display: block !important;
        max-height: none !important;
        opacity: 1 !important;
    }
    
    /* ===== DESIGN MANUAL HEADER ===== */
    .design-manual-header {
        text-align: center !important;
        margin-bottom: 1.5em !important;
        padding-bottom: 1em !important;
        border-bottom: 2px solid #FF6B35 !important;
    }
    
    .design-manual-header h1 {
        font-size: 18pt !important;
        color: #333 !important;
        margin: 0 0 0.3em 0 !important;
    }
    
    .design-manual-header p {
        font-size: 11pt !important;
        color: #666 !important;
        margin: 0.2em 0 !important;
    }
    
    /* ===== SECTION HEADERS ===== */
    .manual-section h2 {
        font-size: 13pt !important;
        color: #FF6B35 !important;
        border-bottom: 1px solid #FF6B35 !important;
        padding-bottom: 0.3em !important;
        margin-top: 1em !important;
        margin-bottom: 0.5em !important;
        page-break-after: avoid !important;
    }
    
    .manual-section h3 {
        font-size: 11pt !important;
        color: #333 !important;
        margin-top: 0.8em !important;
        margin-bottom: 0.3em !important;
    }
    
    /* ===== INPUT PAGE - First page with given parameters ===== */
    .input-page {
        page-break-after: always !important;
        min-height: auto !important;
        padding: 0.5in !important;
    }
    
    .input-page .given-box {
        column-count: 3 !important;
        column-gap: 0.4in !important;
        column-rule: 1px solid #ddd !important;
        font-size: 9pt !important;
        line-height: 1.6 !important;
        column-fill: balance !important;
    }
    
    .input-page .given-box .input-item {
        break-inside: avoid !important;
        padding: 2px 0 !important;
    }
    
    /* ===== FORMULA BOXES ===== */
    .formula-box {
        background: #f8f9fa !important;
        border: 1px solid #ddd !important;
        border-left: 3px solid #FF6B35 !important;
        padding: 0.5em 1em !important;
        margin: 0.5em 0 !important;
        font-family: 'Courier New', monospace !important;
        font-size: 10pt !important;
        page-break-inside: avoid !important;
    }
    
    .condition-box {
        background: #fff3e0 !important;
        border: 1px solid #ffcc80 !important;
        border-left: 3px solid #ff9800 !important;
        padding: 0.5em 1em !important;
        margin: 0.5em 0 !important;
        font-size: 10pt !important;
        page-break-inside: avoid !important;
    }
    
    .result-box {
        background: #e8f5e9 !important;
        border: 1px solid #a5d6a7 !important;
        border-left: 3px solid #4caf50 !important;
        padding: 0.5em 1em !important;
        margin: 0.5em 0 !important;
        font-size: 10pt !important;
        page-break-inside: avoid !important;
    }
    
    /* ===== TABLES ===== */
    .manual-section table {
        width: 100% !important;
        border-collapse: collapse !important;
        font-size: 9pt !important;
        margin: 0.5em 0 !important;
        page-break-inside: avoid !important;
    }
    
    .manual-section th,
    .manual-section td {
        border: 1px solid #ddd !important;
        padding: 4px 8px !important;
        text-align: left !important;
    }
    
    .manual-section th {
        background: #f5f5f5 !important;
        font-weight: bold !important;
    }
    
    /* ===== FINAL MIX DESIGN BOX ===== */
    .final-mix-box,
    .mix-summary-box {
        background: #e3f2fd !important;
        border: 2px solid #1976d2 !important;
        border-radius: 8px !important;
        padding: 1em !important;
        margin: 1em 0 !important;
        page-break-inside: avoid !important;
    }
    
    .final-mix-box h3,
    .mix-summary-box h3 {
        color: #1976d2 !important;
        border-bottom: 1px solid #1976d2 !important;
        padding-bottom: 0.3em !important;
        margin-bottom: 0.5em !important;
    }
    
    /* ===== FINAL RESULT GRID (DM summary) ===== */
    .final-result {
        background: #FFFDE7 !important;
        border: 2px solid #FBC02D !important;
        border-radius: 4px !important;
        padding: 1.2em !important;
        margin: 1.5em 0 !important;
        text-align: center !important;
        page-break-inside: avoid !important;
    }
    
    .final-result h2 {
        color: #F57F17 !important;
        font-size: 14pt !important;
        margin-top: 0 !important;
    }
    
    .final-grid {
        display: grid !important;
        grid-template-columns: repeat(3, 1fr) !important;
        gap: 0.6em !important;
        margin: 1em 0 !important;
    }
    
    .final-item {
        background: white !important;
        border: 1px solid #FBC02D !important;
        border-radius: 4px !important;
        padding: 0.6em !important;
        text-align: center !important;
    }
    
    .final-item-label {
        color: #555 !important;
        font-size: 9pt !important;
        margin-bottom: 0.3em !important;
    }
    
    .final-item-value {
        color: #F57F17 !important;
        font-family: 'Courier New', monospace !important;
        font-weight: bold !important;
        font-size: 11pt !important;
    }
    
    /* ===== PAGE BREAKS ===== */
    .manual-section {
        page-break-inside: avoid !important;
    }
    
    .step-divider {
        page-break-before: auto !important;
    }
    
    /* Force page break before certain sections */
    .calculations-pages {
        page-break-before: always !important;
    }
    
    /* Avoid orphan headers */
    h2, h3, h4 {
        page-break-after: avoid !important;
    }
    
    /* Keep calculation steps together */
    .calculation-step {
        page-break-inside: avoid !important;
    }
}

/* ==========================================
   SLEEPER STACKING CALCULATOR STYLES
   ========================================== */

.sleeper-calculator-area {
    background: var(--surface);
    border-radius: 8px;
    padding: 1.5em;
    margin-bottom: 1em;
}

.sleeper-calculator-area .calculator-header {
    margin-bottom: 1.5em;
}

.sleeper-calculator-area .calculator-header h3 {
    color: var(--accent);
    font-size: 1.3em;
    margin: 0 0 0.3em 0;
}

.sleeper-calculator-area .mode-note {
    color: var(--text-secondary);
    font-size: 0.9em;
}

/* Sleeper Section Groups */
.sleeper-section {
    background: var(--surface-secondary);
    border-radius: 6px;
    padding: 1em;
    margin-bottom: 1em;
    border-left: 3px solid var(--accent);
}

.sleeper-section .section-title {
    color: var(--accent);
    font-size: 1em;
    margin: 0 0 0.8em 0;
    font-weight: 600;
}

.sleeper-section .form-row.tight {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1em;
}

.sleeper-section .form-group {
    flex: 1;
    min-width: 150px;
}

.sleeper-section .form-group label {
    display: block;
    font-size: 0.85em;
    color: var(--text-secondary);
    margin-bottom: 0.3em;
}

.sleeper-section .form-group input,
.sleeper-section .form-group select {
    width: 100%;
    padding: 0.5em;
    background: var(--input-bg);
    border: 1px solid var(--border);
    border-radius: 4px;
    color: var(--text);
    font-size: 0.95em;
}

.sleeper-section .form-group input:focus,
.sleeper-section .form-group select:focus {
    border-color: var(--accent);
    outline: none;
    box-shadow: 0 0 0 2px rgba(255, 107, 53, 0.2);
}

.sleeper-section .form-group input:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Results Section */
.sleeper-results {
    background: var(--surface-secondary);
    border-radius: 6px;
    padding: 1.5em;
    margin-top: 1.5em;
    border: 2px solid var(--accent);
}

.sleeper-results .section-title {
    color: var(--accent);
    font-size: 0.9em;
    margin: 0 0 0.5em 0;
    font-weight: 600;
}

.sleeper-results-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.5em;
    overflow: hidden;
}

.result-section {
    background: var(--surface);
    border-radius: 4px;
    padding: 0.5em 0.75em;
    overflow: hidden;
}

.result-section h5 {
    color: var(--accent);
    font-size: 0.75em;
    margin: 0 0 0.4em 0;
    padding-bottom: 0.3em;
    border-bottom: 1px solid var(--border);
}

.result-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.2em 0;
    border-bottom: 1px solid var(--border-subtle, rgba(255,255,255,0.05));
    gap: 0.3em;
}

.result-item:last-child {
    border-bottom: none;
}

.result-label {
    color: var(--text-secondary);
    font-size: 0.65em;
    flex-shrink: 1;
    min-width: 0;
}

.result-value {
    color: var(--text);
    font-weight: 600;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.7em;
    white-space: nowrap;
}

.result-item.fit-status .result-value.fits {
    color: var(--success, #00d4aa);
    font-weight: 700;
}

.result-item.fit-status .result-value.no-fit {
    color: var(--error, #ff6b6b);
    font-weight: 700;
}

/* === User Input Parameters Section === */
.input-params-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 0.5em;
    margin-bottom: 0.75em;
    overflow: hidden;
}

.param-group {
    background: var(--surface);
    border-radius: 4px;
    padding: 0.5em 0.75em;
    border: 1px solid var(--border-subtle, rgba(255,255,255,0.05));
    overflow: hidden;
}

.param-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.15em 0;
    border-bottom: 1px solid var(--border-subtle, rgba(255,255,255,0.05));
    gap: 0.5em;
}

.param-item:last-child {
    border-bottom: none;
}

.param-label {
    color: var(--text-secondary);
    font-size: 0.7em;
    flex-shrink: 1;
    min-width: 0;
}

.param-value {
    color: var(--accent);
    font-weight: 600;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.75em;
    text-align: right;
    white-space: nowrap;
}

/* === Step-by-Step Calculation Section === */
.calculation-steps {
    display: flex;
    flex-direction: column;
    gap: 0.5em;
    margin-bottom: 0.75em;
    overflow: hidden;
}

.calc-step {
    display: flex;
    gap: 0.75em;
    background: var(--surface);
    border-radius: 4px;
    padding: 0.5em 0.75em;
    border-left: 3px solid var(--accent);
    overflow: hidden;
}

.calc-step.step-success {
    border-left-color: var(--success, #00d4aa);
    background: rgba(0, 212, 170, 0.05);
}

.calc-step.step-warning {
    border-left-color: var(--error, #ff6b6b);
    background: rgba(255, 107, 107, 0.05);
}

.step-number {
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    background: var(--accent);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.65em;
    font-weight: 700;
    text-align: center;
    line-height: 1;
}

.step-content {
    flex: 1;
    min-width: 0;
    overflow: hidden;
}

.step-title {
    color: var(--text);
    font-weight: 600;
    font-size: 0.8em;
    margin-bottom: 0.2em;
}

.step-formula {
    color: var(--text-secondary);
    font-size: 0.7em;
    font-family: 'JetBrains Mono', monospace;
    padding: 0.1em 0;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.step-calculation {
    color: var(--teal, #05dfd7);
    font-size: 0.7em;
    font-family: 'JetBrains Mono', monospace;
    padding: 0.1em 0;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.step-result {
    color: var(--text);
    font-size: 0.75em;
    margin-top: 0.15em;
}

.step-result strong {
    color: var(--accent);
}

.step-result.fit-yes {
    color: var(--success, #00d4aa);
}

.step-result.fit-no {
    color: var(--error, #ff6b6b);
}

/* Action buttons alignment */
.sleeper-calculator-area .action-buttons-row {
    display: flex;
    gap: 1em;
    margin-top: 1em;
    flex-wrap: wrap;
}

.sleeper-calculator-area .calculate-btn {
    flex: 1;
    min-width: 150px;
}

/* Light theme adjustments */
html:not(.dark) .sleeper-calculator-area {
    background: #ffffff;
}

html:not(.dark) .sleeper-section {
    background: #f8fafc;
}

html:not(.dark) .sleeper-results {
    background: #f8fafc;
}

html:not(.dark) .result-section {
    background: #ffffff;
}

html:not(.dark) .param-group {
    background: #ffffff;
    border-color: rgba(45, 66, 99, 0.1);
}

html:not(.dark) .param-item {
    border-color: rgba(45, 66, 99, 0.1);
}

html:not(.dark) .calc-step {
    background: #ffffff;
}

html:not(.dark) .step-number {
    background: var(--accent);
    color: white;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .sleeper-section .form-row.tight {
        grid-template-columns: 1fr 1fr;
    }
    
    .sleeper-results-grid {
        grid-template-columns: 1fr 1fr;
    }
    
    .input-params-grid {
        grid-template-columns: 1fr 1fr;
    }
    
    .sleeper-results-panel {
        max-width: 95%;
    }
}

@media (max-width: 480px) {
    .sleeper-section .form-row.tight {
        grid-template-columns: 1fr;
    }
    
    .sleeper-results-grid {
        grid-template-columns: 1fr;
    }
    
    .input-params-grid {
        grid-template-columns: 1fr;
    }
}

/* Sleeper Calculator - No scroll, same styling as user-input-area */
#sleeper-calculator-area {
    background: var(--surface-base);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
    flex: 1 1 auto;
    overflow: visible;
}

#sleeper-calculator-area > form {
    flex: 1;
}

/* Sleeper System Feedback - uses base .system-feedback styles with status colors */
.sleeper-system-feedback.success {
    border-left-color: var(--success, #00d4aa);
    color: var(--success, #00d4aa);
}

.sleeper-system-feedback.error {
    border-left-color: var(--error, #ff6b6b);
    color: var(--error, #ff6b6b);
}

.sleeper-system-feedback.info {
    border-left-color: var(--accent, #ff6b35);
    color: var(--accent, #ff6b35);
}

/* === Sleeper Results Inline (Right Column) === */
.sleeper-results-inline {
    font-size: 0.85em;
}

.sleeper-section-header {
    color: var(--accent);
    font-weight: 600;
    font-size: 0.9em;
    margin: 0.8em 0 0.4em 0;
    padding-bottom: 0.3em;
    border-bottom: 1px solid var(--border);
}

.sleeper-section-header:first-child {
    margin-top: 0;
}

.sleeper-params-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5em 1em;
    font-size: 0.85em;
    color: var(--text-secondary);
    margin-bottom: 0.3em;
}

.sleeper-params-row strong {
    color: var(--text);
}

.sleeper-steps-compact {
    font-size: 0.85em;
}

.sleeper-step {
    padding: 0.3em 0;
    border-bottom: 1px solid var(--border-subtle, rgba(255,255,255,0.05));
    color: var(--text-secondary);
    word-break: break-word;
    overflow-wrap: break-word;
}

.sleeper-step:last-child {
    border-bottom: none;
}

.sleeper-step strong {
    color: var(--text);
}

.sleeper-step .accent {
    color: var(--accent);
    font-weight: 600;
}

.sleeper-step .success {
    color: var(--success, #00d4aa);
    font-weight: 600;
}

.sleeper-step .error {
    color: var(--error, #ff6b6b);
    font-weight: 600;
}

.sleeper-step.fit-ok {
    background: rgba(0, 212, 170, 0.1);
    padding: 0.4em 0.5em;
    border-radius: 4px;
    margin: 0.2em 0;
}

.sleeper-step.fit-fail {
    background: rgba(255, 107, 107, 0.1);
    padding: 0.4em 0.5em;
    border-radius: 4px;
    margin: 0.2em 0;
}

.sleeper-final-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75em;
}

.sleeper-result-box {
    background: var(--surface);
    border-radius: 6px;
    padding: 0.6em 0.8em;
    border: 1px solid var(--border);
}

.sleeper-result-box .result-title {
    color: var(--accent);
    font-weight: 600;
    font-size: 0.85em;
    margin-bottom: 0.4em;
    padding-bottom: 0.3em;
    border-bottom: 1px solid var(--border);
}

.sleeper-result-box .result-row {
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.2em 0.5em;
    padding: 0.2em 0;
    font-size: 0.85em;
    min-width: 0;
}

.sleeper-result-box .result-row span {
    color: var(--text-secondary);
    flex-shrink: 0;
}

.sleeper-result-box .result-row strong {
    color: var(--text);
    font-family: 'JetBrains Mono', monospace;
    word-break: break-word;
    overflow-wrap: break-word;
    text-align: right;
}

.sleeper-fit-status {
    padding: 0.5em 0.8em;
    border-radius: 6px;
    margin-top: 0.75em;
    text-align: center;
    font-weight: 600;
    font-size: 0.85em;
}

.sleeper-fit-status.fits {
    background: rgba(0, 212, 170, 0.15);
    color: var(--success, #00d4aa);
    border: 1px solid var(--success, #00d4aa);
}

.sleeper-fit-status.no-fit {
    background: rgba(255, 107, 107, 0.15);
    color: var(--error, #ff6b6b);
    border: 1px solid var(--error, #ff6b6b);
}

.sleeper-action-row {
    margin-top: 0.75em;
    display: flex;
    gap: 0.5em;
}

.sleeper-print-btn {
    padding: var(--space-sm) var(--space-lg);
    background: linear-gradient(135deg, var(--accent-orange), var(--accent-orange-hover));
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-family: var(--font-display);
    font-size: 12px;
    font-weight: 700;
    transition: all var(--transition-base);
    box-shadow: 0 2px 8px rgba(255, 107, 53, 0.3);
    position: relative;
    overflow: hidden;
}

.sleeper-print-btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.sleeper-print-btn:hover::before {
    width: 300px;
    height: 300px;
}

.sleeper-print-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 107, 53, 0.5);
}

/* ==========================================
   STACKING LAYOUT VISUALIZATION
   ========================================== */

.stacking-layout-view .manual-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.8em 1.2em;
    background: #1a2533;
    border-bottom: 2px solid #ff6b35;
}

.stacking-layout-view .manual-header h2 {
    color: #ff6b35;
    margin: 0;
    font-size: 1.2em;
}

.stacking-layout-view .manual-header .manual-btn {
    background: #ff6b35;
    color: white;
    border: none;
    padding: 0.4em 0.8em;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.9em;
}

.stacking-layout-view .manual-header .manual-btn:hover {
    background: #ff8555;
}

.stacking-layout-view .manual-header .manual-btn.close {
    background: transparent;
    font-size: 1.1em;
    padding: 0.2em 0.5em;
    color: #ff6b35;
}

.stacking-layout-view .manual-header .manual-btn.close:hover {
    background: rgba(255, 107, 53, 0.2);
}

.stacking-layout-content {
    padding: 1em;
    background: #0f1923;
}

.stacking-layout-content .layout-header {
    text-align: center;
    margin-bottom: 1em;
    padding: 0.8em;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.stacking-layout-content .layout-header h3 {
    color: #ff6b35;
    margin: 0 0 0.2em 0;
    font-size: 1.2em;
}

.stacking-layout-content .layout-header .timestamp {
    color: #809fbe;
    font-size: 0.8em;
    margin: 0;
}

.stacking-layout-content .manual-section {
    margin-bottom: 1em;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    overflow: hidden;
    background: #0f1923;
}

.stacking-layout-content .section-toggle {
    background: #1a2533;
    padding: 0.6em 0.8em;
    margin: 0;
    font-size: 0.95em;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.4em;
    color: #f6f9ff;
}

.stacking-layout-content .section-toggle:hover {
    background: #223242;
}

.stacking-layout-content .section-content {
    padding: 0.8em;
    background: #0f1923;
}

.stacking-layout-content .manual-section.collapsed .section-content {
    display: none;
}

/* Given section grid */
.layout-given-section .given-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 0.5em;
}

.layout-given-section .given-item {
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.2em 0.5em;
    padding: 0.4em 0.6em;
    background: #1a2533;
    border-radius: 3px;
    font-size: 0.85em;
    min-width: 0;
}

.layout-given-section .given-label {
    color: #cfd9e7;
    flex-shrink: 0;
}

.layout-given-section .given-value {
    color: #05dfd7;
    font-weight: 600;
    font-family: 'JetBrains Mono', monospace;
    word-break: break-word;
    overflow-wrap: break-word;
    text-align: right;
}

/* Calculation Steps */
.layout-calc-steps {
    display: flex;
    flex-direction: column;
    gap: 0.6em;
}

.layout-calc-steps .calc-step {
    display: flex;
    gap: 0.8em;
    background: #1a2533;
    border-radius: 4px;
    padding: 0.8em;
    border-left: 3px solid #ff6b35;
}

.layout-calc-steps .calc-step.step-success {
    border-left-color: #00d4aa;
}

.layout-calc-steps .calc-step.step-fail {
    border-left-color: #ff6b6b;
}

.layout-calc-steps .step-number {
    width: 24px;
    height: 24px;
    min-width: 24px;
    background: #ff6b35;
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75em;
    font-weight: 700;
}

.layout-calc-steps .calc-step.step-success .step-number {
    background: #00d4aa;
}

.layout-calc-steps .calc-step.step-fail .step-number {
    background: #ff6b6b;
}

.layout-calc-steps .step-content {
    flex: 1;
    min-width: 0;
    word-break: break-word;
    overflow-wrap: break-word;
}

.layout-calc-steps .step-title {
    font-weight: 600;
    color: #f6f9ff;
    margin-bottom: 0.3em;
    font-size: 0.9em;
}

.layout-calc-steps .step-formula {
    color: #809fbe;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.8em;
    margin-bottom: 0.2em;
}

.layout-calc-steps .step-calc {
    color: #ffd23f;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.8em;
    margin-bottom: 0.2em;
}

.layout-calc-steps .step-result {
    color: #cfd9e7;
    font-size: 0.85em;
    margin-top: 0.3em;
}

.layout-calc-steps .step-result strong {
    color: #05dfd7;
    font-family: 'JetBrains Mono', monospace;
}

.layout-calc-steps .calc-step.step-success .step-result strong {
    color: #00d4aa;
}

.layout-calc-steps .calc-step.step-fail .step-result strong {
    color: #ff6b6b;
}

/* Bundle grid visualization */
.layout-legend {
    display: flex;
    justify-content: space-between;
    padding: 0.5em 0.8em;
    background: #1a2533;
    border-radius: 4px;
    margin-bottom: 0.8em;
    font-size: 0.8em;
    color: #cfd9e7;
}

.bundle-grid-container {
    overflow-x: auto;
    padding: 1em;
    background: #1a2533;
    border-radius: 4px;
}

.yard-header {
    background: #ff6b35;
    color: #fff;
    padding: 8px 12px;
    border-radius: 4px;
    font-weight: 600;
    margin: 10px 0 8px 0;
    text-align: center;
}

.yard-header:first-child {
    margin-top: 0;
}

.grid-labels {
    font-size: 0.75em;
    color: #cfd9e7;
    margin-bottom: 4px;
    padding-left: 60px;
}

.row-label {
    width: 55px;
    font-size: 0.65em;
    color: #cfd9e7;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding-right: 5px;
    flex-shrink: 0;
}

.yards-total {
    background: #00d4aa;
    color: #000;
    padding: 10px 15px;
    border-radius: 4px;
    font-weight: 600;
    margin-top: 15px;
    text-align: center;
}

.bundle-grid {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: fit-content;
}

.bundle-row {
    display: flex;
    gap: 8px;
}

.bundle-cell {
    width: 35px;
    height: 50px;
    flex-shrink: 0;
    background: #3d5a80;
    border: 1px solid #05dfd7;
    border-radius: 4px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s;
}

.bundle-cell:hover {
    background: #4d6a90;
    border-color: #ffd23f;
}

.bundle-cell.empty {
    background: transparent;
    border: 1px dashed #3d5a80;
    cursor: default;
}

.bundle-num {
    font-size: 0.75em;
    font-weight: 600;
    color: #f6f9ff;
    line-height: 1;
}

.bundle-sleepers {
    font-size: 0.55em;
    color: #cfd9e7;
    opacity: 0.8;
    line-height: 1;
}

/* Results summary boxes */
.layout-results-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 0.8em;
}

.layout-results-summary .result-box {
    background: #1a2533;
    padding: 0.8em;
    border-radius: 4px;
    border-left: 3px solid #ff6b35;
}

.layout-results-summary .result-box.fits {
    border-left-color: #00d4aa;
}

.layout-results-summary .result-box.no-fit {
    border-left-color: #ff6b6b;
}

.layout-results-summary .result-title {
    color: #ff6b35;
    font-weight: 600;
    font-size: 0.85em;
    margin-bottom: 0.4em;
    text-transform: uppercase;
}

.layout-results-summary .result-box.fits .result-title {
    color: #00d4aa;
}

.layout-results-summary .result-box.no-fit .result-title {
    color: #ff6b6b;
}

.layout-results-summary .result-detail {
    color: #cfd9e7;
    font-size: 0.8em;
    padding: 0.2em 0;
}

.layout-results-summary .result-detail strong {
    color: #05dfd7;
    font-family: 'JetBrains Mono', monospace;
}

.layout-results-summary .fit-status-line {
    margin-top: 0.4em;
    padding: 0.4em 0.6em;
    border-radius: 3px;
    font-weight: 600;
    text-align: center;
    font-size: 0.8em;
}

.layout-results-summary .result-box.fits .fit-status-line {
    background: rgba(0, 212, 170, 0.15);
    color: #00d4aa;
}

.layout-results-summary .result-box.no-fit .fit-status-line {
    background: rgba(255, 107, 107, 0.15);
    color: #ff6b6b;
}

/* Light theme overrides for stacking layout */
html:not(.dark) .stacking-layout-content {
    background: #f3f6f9;
}

html:not(.dark) .stacking-layout-content .manual-section {
    background: #ffffff;
    border-color: rgba(45, 66, 99, 0.12);
}

html:not(.dark) .stacking-layout-content .section-toggle {
    background: #f8fafc;
    color: #1a2533;
}

html:not(.dark) .stacking-layout-content .section-content {
    background: #ffffff;
}

html:not(.dark) .layout-given-section .given-item {
    background: #f8fafc;
}

html:not(.dark) .layout-given-section .given-label {
    color: #4a5568;
}

html:not(.dark) .layout-calc-steps .calc-step {
    background: #f8fafc;
}

html:not(.dark) .layout-calc-steps .step-title {
    color: #1a2533;
}

html:not(.dark) .layout-calc-steps .step-result {
    color: #4a5568;
}

/* Force black text in stacking layout calculation steps */
.layout-calc-steps .calc-step {
    border-left-color: #333;
}

.layout-calc-steps .step-number {
    background: #333;
    color: #fff;
}

.layout-calc-steps .step-title {
    color: #000;
}

.layout-calc-steps .step-formula {
    color: #000;
}

.layout-calc-steps .step-calc {
    color: #000;
}

.layout-calc-steps .step-result {
    color: #000;
}

.layout-calc-steps .step-result strong {
    color: #000;
}

html:not(.dark) .bundle-grid-container {
    background: #f8fafc;
}

html:not(.dark) .bundle-cell {
    background: #3d5a80;
}

html:not(.dark) .layout-results-summary .result-box {
    background: #f8fafc;
}

html:not(.dark) .layout-results-summary .result-detail {
    color: #4a5568;
}

/* Light theme for inline results */
html:not(.dark) .sleeper-result-box {
    background: #f8fafc;
}

html:not(.dark) .sleeper-step.fit-ok {
    background: rgba(0, 212, 170, 0.08);
}

html:not(.dark) .sleeper-step.fit-fail {
    background: rgba(255, 107, 107, 0.08);
}

/* Sleeper Results Overlay (kept for print preview) */
.sleeper-results-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1em;
    box-sizing: border-box;
    overflow: hidden;
}

.sleeper-results-panel {
    background: var(--surface);
    border-radius: 8px;
    max-width: 700px;
    width: 95%;
    max-height: 80vh;
    overflow-y: auto;
    overflow-x: hidden;
    scroll-behavior: smooth;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
    border: 1px solid var(--border);
    box-sizing: border-box;
}

/* Custom scrollbar for sleeper results */
.sleeper-results-panel::-webkit-scrollbar {
    width: 8px;
}

.sleeper-results-panel::-webkit-scrollbar-track {
    background: var(--surface-secondary, #1a2533);
    border-radius: 0 8px 8px 0;
}

.sleeper-results-panel::-webkit-scrollbar-thumb {
    background: var(--accent);
    border-radius: 5px;
    border: 2px solid var(--surface-secondary, #1a2533);
}

.sleeper-results-panel::-webkit-scrollbar-thumb:hover {
    background: var(--accent-hover, #ff8555);
}

/* Firefox scrollbar support */
@supports (scrollbar-color: auto) {
    .sleeper-results-panel {
        scrollbar-width: thin;
        scrollbar-color: var(--accent) var(--surface-secondary, #1a2533);
    }
}

.sleeper-results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.6em 1em;
    border-bottom: 2px solid var(--accent);
    background: var(--surface-secondary);
    border-radius: 8px 8px 0 0;
    position: sticky;
    top: 0;
    z-index: 10;
}

.sleeper-results-header h4 {
    font-size: 0.95em;
}

.sleeper-results-actions {
    display: flex;
    gap: 0.4em;
}

.results-action-btn {
    padding: 0.35em 0.75em;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: var(--surface);
    color: var(--text);
    cursor: pointer;
    font-size: 0.75em;
    transition: all 0.2s ease;
}

.results-action-btn:hover {
    background: var(--accent);
    color: white;
    border-color: var(--accent);
}

.results-action-btn.close-btn {
    background: transparent;
    border: none;
    font-size: 1em;
    padding: 0.2em 0.5em;
    color: var(--text-secondary);
}

.results-action-btn.close-btn:hover {
    color: var(--error, #ff6b6b);
    background: rgba(255, 107, 107, 0.1);
}

.sleeper-results-content {
    padding: 0.75em 1em;
    overflow: hidden;
    box-sizing: border-box;
}

.sleeper-results-content .result-section.full-width {
    margin-bottom: 0.5em;
}

.sleeper-results-content .result-section.full-width h5 {
    font-size: 0.8em;
    margin-bottom: 0.4em;
    padding-bottom: 0.25em;
}

.sleeper-results-panel .sleeper-results-grid {
    padding: 0;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.5em;
    overflow: hidden;
}

/* Light theme adjustments */
html:not(.dark) .sleeper-results-overlay {
    background: rgba(0, 0, 0, 0.5);
}

html:not(.dark) .sleeper-results-panel {
    background: #ffffff;
}

html:not(.dark) .sleeper-results-header {
    background: #f8fafc;
}

html:not(.dark) .sleeper-results-panel::-webkit-scrollbar-track {
    background: #f3f6f9;
}

html:not(.dark) .sleeper-results-panel::-webkit-scrollbar-thumb {
    border-color: #f3f6f9;
}
