/* Self-hosted fonts - no Google dependency */

/* Skip link for accessibility */
.skip-link {
    position: absolute;
    top: -40px;
    left: 0;
    background: var(--amber);
    color: #000;
    padding: 8px 16px;
    z-index: 10000;
    font-weight: 600;
    text-decoration: none;
    border-radius: 0 0 8px 0;
}
.skip-link:focus {
    top: 0;
}

@font-face {
    font-family: 'Inter';
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url('fonts/inter-latin-400-normal.woff2') format('woff2');
}
@font-face {
    font-family: 'Inter';
    font-style: normal;
    font-weight: 500;
    font-display: swap;
    src: url('fonts/inter-latin-500-normal.woff2') format('woff2');
}
@font-face {
    font-family: 'Inter';
    font-style: normal;
    font-weight: 600;
    font-display: swap;
    src: url('fonts/inter-latin-600-normal.woff2') format('woff2');
}
@font-face {
    font-family: 'Inter';
    font-style: normal;
    font-weight: 700;
    font-display: swap;
    src: url('fonts/inter-latin-700-normal.woff2') format('woff2');
}
@font-face {
    font-family: 'Inter';
    font-style: normal;
    font-weight: 800;
    font-display: swap;
    src: url('fonts/inter-latin-800-normal.woff2') format('woff2');
}
@font-face {
    font-family: 'Inter';
    font-style: normal;
    font-weight: 900;
    font-display: swap;
    src: url('fonts/inter-latin-900-normal.woff2') format('woff2');
}
@font-face {
    font-family: 'Playfair Display';
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url('fonts/playfair-display-latin-400-normal.woff2') format('woff2');
}
@font-face {
    font-family: 'Playfair Display';
    font-style: normal;
    font-weight: 600;
    font-display: swap;
    src: url('fonts/playfair-display-latin-600-normal.woff2') format('woff2');
}
@font-face {
    font-family: 'Playfair Display';
    font-style: normal;
    font-weight: 700;
    font-display: swap;
    src: url('fonts/playfair-display-latin-700-normal.woff2') format('woff2');
}

:root {
    --bg-dark: #0a0908;
    --bg-warm: #12100d;
    --card: #1a1814;
    --card-light: #252118;
    --card-border: #3a3428;
    --amber: #F59E0B;
    --amber-bright: #FBBF24;
    --amber-dim: #B45309;
    --amber-glow: rgba(245, 158, 11, 0.4);
    --honey: #FCD34D;
    --cream: #FEF3C7;
    --cream-dim: #D4C5A0;
    --flame-orange: #FB923C;
    --flame-red: #F87171;
    --text: #fff;
    --text-dim: #9a9080;
}
* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html { -webkit-overflow-scrolling: touch; overscroll-behavior: none; }
/* Safari/iOS Fixes */
@supports (-webkit-touch-callout: none) {
    input, select, textarea { font-size: 16px !important; }
    button { -webkit-appearance: none; }
}
input, select, textarea { font-size: 16px; }
body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-dark);
    min-height: 100vh;
    min-height: -webkit-fill-available;
    color: var(--text);
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
    padding-bottom: 0 !important;
}
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

/* App Layout */
.app-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    padding-bottom: max(120px, calc(100px + env(safe-area-inset-bottom)));
    position: relative;
    z-index: 1;
}

/* Header */
.app-header {
    text-align: center;
    margin-bottom: 30px;
    padding: 30px 20px;
    background: linear-gradient(180deg, var(--card) 0%, transparent 100%);
    border-radius: 20px;
    position: relative;
    overflow: hidden;
}
.app-header::before {
    content: '';
    position: absolute;
    top: -50%;
    left: 50%;
    transform: translateX(-50%);
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, var(--amber-glow) 0%, transparent 70%);
    pointer-events: none;
    opacity: 0.6;
}
.back-btn {
    position: absolute;
    top: 20px;
    left: 20px;
    color: var(--cream-dim);
    text-decoration: none;
    font-size: 0.8rem;
    font-weight: 700;
    padding: 8px 14px 8px 28px;
    background: var(--card);
    border-radius: 6px;
    border: 1px solid var(--card-border);
    transition: all 0.2s;
}
.back-btn::before {
    content: '‹';
    position: absolute;
    left: 10px;
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--flame);
    line-height: 1;
}
.back-btn:hover {
    color: var(--cream);
    border-color: var(--amber);
}
.header-actions {
    position: absolute;
    top: 15px;
    right: 15px;
    display: flex;
    gap: 10px;
    align-items: center;
    z-index: 10;
}
.header-actions .icon-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--card);
    border: 1px solid var(--card-border);
    color: var(--cream);
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
}
.header-actions .icon-btn:hover {
    border-color: var(--amber);
    background: var(--card-hover);
}
.shop-link {
    padding: 8px 14px;
    background: linear-gradient(135deg, var(--amber) 0%, var(--flame-orange) 100%);
    color: var(--bg-dark);
    text-decoration: none;
    border-radius: 20px;
    font-weight: 700;
    font-size: 0.8rem;
    letter-spacing: 0.02em;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(245, 158, 11, 0.3);
    will-change: transform, box-shadow;
}
@media (hover: hover) {
    .shop-link:hover {
        transform: scale(1.02);
        box-shadow: 0 6px 25px rgba(245, 158, 11, 0.5);
    }
}
.shop-link:active {
    transform: scale(0.98);
}

/* Candle Icon */
.candle-icon {
    position: relative;
    width: 60px;
    height: 100px;
    margin: 0 auto 20px;
}
.candle-body {
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 40px;
    height: 60px;
    background: linear-gradient(180deg, var(--cream) 0%, var(--cream-dim) 100%);
    border-radius: 5px 5px 8px 8px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.3);
}
.candle-wick {
    position: absolute;
    bottom: 60px;
    left: 50%;
    transform: translateX(-50%);
    width: 3px;
    height: 12px;
    background: linear-gradient(180deg, #333 0%, #1a1a1a 100%);
    border-radius: 2px;
}
.candle-flame {
    position: absolute;
    bottom: 70px;
    left: 50%;
    transform: translateX(-50%);
    width: 20px;
    height: 40px;
    background: radial-gradient(ellipse at 50% 90%, var(--honey) 0%, var(--flame-orange) 40%, transparent 70%);
    border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%;
}
.candle-flame::before {
    content: '';
    position: absolute;
    bottom: 5px;
    left: 50%;
    transform: translateX(-50%);
    width: 10px;
    height: 20px;
    background: radial-gradient(ellipse at 50% 100%, #fff 0%, var(--honey) 50%, transparent 70%);
    border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%;
}
.candle-glow {
    position: absolute;
    bottom: 50px;
    left: 50%;
    transform: translateX(-50%);
    width: 80px;
    height: 80px;
    background: radial-gradient(circle, var(--amber-glow) 0%, transparent 70%);
    opacity: 0.6;
}

.app-title {
    font-family: 'Playfair Display', Georgia, 'Times New Roman', serif;
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--cream);
    margin-bottom: 5px;
    position: relative;
}
.app-title .missa-badge {
    font-size: 0.9rem;
    color: var(--amber);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-weight: 600;
    margin-left: 10px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

/* Missa Unicorn Mascot */
.missa-unicorn {
    width: 24px;
    height: 24px;
    flex-shrink: 0;
}
.missa-unicorn-body {
    fill: none;
    stroke: var(--amber);
    stroke-width: 1.5;
    stroke-linecap: round;
    stroke-linejoin: round;
}
.missa-unicorn-horn {
    fill: var(--amber-bright);
}
.missa-unicorn-mane {
    fill: none;
    stroke: var(--flame-red, #ef4444);
    stroke-width: 1.5;
    stroke-linecap: round;
}
.missa-unicorn-eye {
    fill: var(--amber-bright);
}

.app-subtitle {
    font-size: 1rem;
    color: var(--cream-dim);
    font-weight: 400;
}
.header-badge {
    display: inline-block;
    margin-top: 15px;
    font-size: 0.65rem;
    background: var(--amber-dim);
    color: var(--amber-bright);
    padding: 4px 12px;
    border-radius: 15px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Tool Navigation */
.tool-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 25px;
    padding: 15px 0;
    /* Sticky navigation */
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--bg-dark);
    /* Extend background to cover full width */
    margin-left: -20px;
    margin-right: -20px;
    padding-left: 20px;
    padding-right: 20px;
    /* Subtle shadow when scrolled */
    box-shadow: 0 4px 20px -5px rgba(0, 0, 0, 0);
    transition: box-shadow 0.3s ease;
}
.tool-nav.scrolled {
    box-shadow: 0 4px 20px -5px rgba(0, 0, 0, 0.8);
    border-bottom: 1px solid var(--card-border);
}
@media (max-width: 768px) {
    .tool-nav {
        flex-wrap: nowrap;
        overflow-x: auto;
        scrollbar-width: none;
        -webkit-overflow-scrolling: touch;
        /* Account for mobile safe areas */
        top: env(safe-area-inset-top, 0);
        padding-top: 10px;
        padding-bottom: 10px;
        margin-left: -20px;
        margin-right: -20px;
        padding-left: 20px;
        padding-right: 20px;
    }
    .tool-nav::-webkit-scrollbar { display: none; }
}
.tool-nav-btn {
    flex: 0 0 auto;
    padding: 12px 16px;
    min-height: 44px;
    background: var(--card);
    border: 1px solid var(--card-border);
    border-radius: 10px;
    color: var(--cream-dim);
    font-size: 0.75rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}
/* Mobile: Make all tool buttons same width for cleaner look */
@media (max-width: 768px) {
    .tool-nav-btn {
        min-width: 130px;
        max-width: 130px;
        text-align: center;
        justify-content: center;
        display: flex;
        align-items: center;
        padding: 10px 12px;
        font-size: 0.7rem;
    }
    .tool-nav-btn .icon {
        margin-right: 4px;
        font-size: 1rem;
    }
}
/* Smaller phones */
@media (max-width: 400px) {
    .tool-nav-btn {
        min-width: 115px;
        max-width: 115px;
        padding: 8px 10px;
        font-size: 0.65rem;
    }
}
.tool-nav-btn:hover {
    background: var(--card-light);
    color: var(--cream);
    border-color: var(--amber);
}
.tool-nav-btn.active {
    background: linear-gradient(180deg, var(--amber-dim) 0%, #7C3A05 100%);
    border-color: var(--amber);
    color: var(--amber-bright);
}
.tool-nav-btn .icon {
    margin-right: 6px;
}

/* Tool Panels */
.tool-panel {
    display: none;
    background: var(--card);
    border: 1px solid var(--card-border);
    border-radius: 16px;
    padding: 25px;
    margin-bottom: 20px;
}
.tool-panel.active {
    display: block;
    animation: fadeIn 0.3s ease;
}
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}
.tool-title {
    font-family: 'Playfair Display', Georgia, 'Times New Roman', serif;
    font-size: 1.5rem;
    color: var(--cream);
    margin-bottom: 8px;
}
.tool-desc {
    color: var(--text-dim);
    font-size: 0.85rem;
    margin-bottom: 25px;
    line-height: 1.5;
}

/* Info Sections */
.info-section {
    margin-bottom: 2rem;
}
.info-section h3 {
    color: var(--amber);
    font-size: 1.2rem;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--card-border);
}

/* Guide Steps */
.guide-step {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
    padding: 1.25rem;
    background: var(--card);
    border-radius: 12px;
    border: 1px solid var(--card-border);
}
.step-number {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--amber) 0%, var(--flame-orange) 100%);
    color: var(--bg-dark);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 1.1rem;
}
.step-content h3 {
    color: var(--cream);
    font-size: 1.1rem;
    margin-bottom: 0.75rem;
}
.step-content p {
    color: var(--text-dim);
    margin-bottom: 0.75rem;
    line-height: 1.6;
}
.step-content ul {
    margin: 0;
    padding-left: 1.25rem;
}
.step-content li {
    color: var(--text-dim);
    margin-bottom: 0.5rem;
    line-height: 1.5;
}
.step-content li strong {
    color: var(--cream);
}

/* Science Explanations */
.science-explanation {
    background: var(--card);
    padding: 1.5rem;
    border-radius: 12px;
    border: 1px solid var(--card-border);
    margin-bottom: 1.5rem;
}
.science-explanation h4 {
    color: var(--amber-bright);
    font-size: 1rem;
    margin: 1.25rem 0 0.75rem 0;
}
.science-explanation h4:first-child {
    margin-top: 0;
}
.science-explanation p {
    color: var(--text-dim);
    line-height: 1.7;
    margin-bottom: 0.75rem;
}
.science-explanation ul, .science-explanation ol {
    padding-left: 1.25rem;
    margin-bottom: 1rem;
}
.science-explanation li {
    color: var(--text-dim);
    margin-bottom: 0.5rem;
    line-height: 1.5;
}
.science-explanation li strong {
    color: var(--cream);
}
.formula-box {
    background: rgba(245, 158, 11, 0.1);
    border: 1px solid rgba(245, 158, 11, 0.3);
    border-radius: 8px;
    padding: 1rem 1.25rem;
    margin: 1rem 0;
    font-family: 'Courier New', monospace;
    color: var(--amber-bright);
    text-align: center;
    font-size: 0.9rem;
    line-height: 1.8;
}

/* Form Elements */
.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 25px;
}
.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.form-label {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--cream-dim);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.form-input, .form-select {
    padding: 14px 16px;
    min-height: 48px;
    background: var(--bg-dark);
    border: 2px solid var(--card-border);
    border-radius: 10px;
    color: var(--cream);
    font-size: 1rem;
    font-family: inherit;
    transition: all 0.2s;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}
.form-input:focus, .form-select:focus {
    outline: none;
    border-color: var(--amber);
    box-shadow: 0 0 0 3px var(--amber-glow);
}
.form-input:invalid:not(:placeholder-shown) {
    border-color: var(--flame-red);
}
.form-input:valid:not(:placeholder-shown) {
    border-color: var(--amber-dim);
}
.form-input::placeholder {
    color: var(--text-dim);
}
.form-select option {
    background: var(--bg-dark);
    color: var(--cream);
}
.form-hint {
    font-size: 0.7rem;
    color: var(--text-dim);
    margin-top: -4px;
}

/* Help Tooltips */
.help-tip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--card-border);
    color: var(--text-dim);
    font-size: 10px;
    font-weight: 700;
    cursor: help;
    margin-left: 6px;
    position: relative;
    vertical-align: middle;
    transition: all 0.2s;
    text-transform: none;
    letter-spacing: 0;
    -webkit-tap-highlight-color: transparent;
}
.help-tip:hover,
.help-tip.active {
    background: var(--amber);
    color: var(--bg-dark);
}
.help-tip::after {
    content: attr(data-tip);
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%) scale(0.9);
    background: var(--card);
    border: 1px solid var(--amber);
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 400;
    line-height: 1.5;
    white-space: normal;
    width: max-content;
    max-width: 260px;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s;
    box-shadow: 0 4px 20px rgba(0,0,0,0.4);
    pointer-events: none;
    color: var(--cream);
    text-align: left;
}
.help-tip::before {
    content: '';
    position: absolute;
    bottom: calc(100% + 2px);
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-top-color: var(--amber);
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s;
}
.help-tip:hover::after,
.help-tip:hover::before,
.help-tip.active::after,
.help-tip.active::before {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) scale(1);
}
.help-tip:hover::before,
.help-tip.active::before {
    transform: translateX(-50%);
}
@media (max-width: 600px) {
    /* On mobile, tooltips appear as fixed overlays for better visibility */
    .help-tip::after {
        position: fixed;
        bottom: auto;
        top: 50%;
        left: 50% !important;
        right: auto !important;
        transform: translate(-50%, -50%) scale(0.9);
        max-width: calc(100vw - 40px);
        width: auto;
        min-width: 200px;
        padding: 16px 20px;
        font-size: 14px;
        border-width: 2px;
        box-shadow: 0 10px 40px rgba(0,0,0,0.6);
    }
    .help-tip::before {
        display: none;
    }
    .help-tip:hover::after,
    .help-tip.active::after {
        transform: translate(-50%, -50%) scale(1);
    }
}

/* Calculate Button */
.calc-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 16px 32px;
    min-height: 52px;
    background: linear-gradient(180deg, var(--amber) 0%, var(--amber-dim) 100%);
    border: none;
    border-radius: 12px;
    color: #000;
    font-size: 1rem;
    font-weight: 800;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 4px 15px var(--amber-glow);
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    will-change: transform, box-shadow;
}
@media (hover: hover) {
    .calc-btn:hover {
        transform: scale(1.02);
        box-shadow: 0 6px 25px var(--amber-glow);
    }
}
.calc-btn:active {
    transform: scale(0.98);
}

/* Results */
.results-card {
    background: linear-gradient(135deg, var(--card-light) 0%, var(--card) 100%);
    border: 1px solid var(--amber-dim);
    border-radius: 16px;
    padding: 25px;
    margin-top: 25px;
    position: relative;
    overflow: hidden;
}
.results-card::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, var(--amber-glow) 0%, transparent 70%);
    opacity: 0.1;
    pointer-events: none;
}
.results-title {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--amber);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
}
.result-item {
    background: var(--bg-dark);
    border-radius: 10px;
    padding: 15px;
    text-align: center;
}
.result-label {
    font-size: 0.7rem;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}
.result-value {
    font-size: 1.4rem;
    font-weight: 800;
    color: var(--amber-bright);
    text-shadow: 0 0 20px var(--amber-glow);
}
/* Profit value gets enhanced glow - the money moment */
#costProfit {
    font-family: 'SF Mono', 'Fira Code', ui-monospace, monospace;
    text-shadow: 0 0 30px var(--amber-glow);
}
.result-unit {
    font-size: 0.8rem;
    color: var(--cream-dim);
    font-weight: 600;
}

/* Recipe Builder */
.recipe-container {
    margin-top: 20px;
}
.recipe-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}
.recipe-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--cream);
}
.add-btn {
    padding: 8px 16px;
    background: var(--card-light);
    border: 1px solid var(--card-border);
    border-radius: 8px;
    color: var(--cream-dim);
    font-size: 0.8rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
}
.add-btn:hover {
    border-color: var(--amber);
    color: var(--amber);
}
.recipe-item {
    display: grid;
    grid-template-columns: 1fr 100px 80px 40px;
    gap: 10px;
    align-items: center;
    padding: 12px;
    background: var(--bg-dark);
    border-radius: 10px;
    margin-bottom: 10px;
}
.recipe-item input, .recipe-item select {
    padding: 10px;
    background: var(--card);
    border: 1px solid var(--card-border);
    border-radius: 6px;
    color: var(--cream);
    font-size: 0.85rem;
}
.recipe-item input:focus, .recipe-item select:focus {
    outline: none;
    border-color: var(--amber);
}
.remove-btn {
    width: 36px;
    height: 36px;
    background: rgba(248,113,113,0.2);
    border: 1px solid rgba(248,113,113,0.4);
    border-radius: 8px;
    color: #F87171;
    font-size: 1.2rem;
    cursor: pointer;
    transition: all 0.2s;
}
.remove-btn:hover {
    background: rgba(248,113,113,0.3);
}

/* Wick Guide Table */
.wick-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
    font-size: 0.85rem;
}
.wick-table th {
    background: var(--card-light);
    color: var(--amber);
    padding: 12px;
    text-align: left;
    font-weight: 700;
    text-transform: uppercase;
    font-size: 0.7rem;
    letter-spacing: 0.5px;
}
.wick-table td {
    padding: 12px;
    border-bottom: 1px solid var(--card-border);
    color: var(--cream-dim);
}
.wick-table tr:hover td {
    background: var(--card-light);
    color: var(--cream);
}
.wick-match {
    background: rgba(245,158,11,0.15) !important;
}
.wick-match td {
    color: var(--amber-bright) !important;
}

/* Wax Types Info */
.wax-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 15px;
    margin-top: 20px;
}
.wax-card {
    background: var(--bg-dark);
    border: 1px solid var(--card-border);
    border-radius: 12px;
    padding: 20px;
    transition: all 0.2s;
}
.wax-card:hover {
    border-color: var(--amber);
}
.wax-name {
    font-size: 1rem;
    font-weight: 700;
    color: var(--cream);
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.wax-details {
    font-size: 0.8rem;
    color: var(--text-dim);
    line-height: 1.6;
}
.wax-detail {
    display: flex;
    justify-content: space-between;
    padding: 5px 0;
    border-bottom: 1px solid var(--card-border);
}
.wax-detail:last-child {
    border-bottom: none;
}
.wax-detail-label {
    color: var(--cream-dim);
}
.wax-detail-value {
    color: var(--amber);
    font-weight: 600;
}

/* Cure Timer */
.timer-display {
    text-align: center;
    padding: 30px;
    background: var(--bg-dark);
    border-radius: 16px;
    margin-top: 20px;
}
.timer-time {
    font-size: 3rem;
    font-weight: 900;
    color: var(--amber-bright);
    font-family: 'JetBrains Mono', monospace;
    text-shadow: 0 0 30px var(--amber-glow);
}
.timer-label {
    font-size: 0.85rem;
    color: var(--text-dim);
    margin-top: 10px;
}
.timer-controls {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: 20px;
}
.timer-btn {
    padding: 12px 24px;
    background: var(--card);
    border: 1px solid var(--card-border);
    border-radius: 10px;
    color: var(--cream);
    font-size: 0.85rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
}
.timer-btn:hover {
    border-color: var(--amber);
    color: var(--amber);
}
.timer-btn.primary {
    background: var(--amber);
    border-color: var(--amber);
    color: #000;
}
.timer-btn.primary:hover {
    background: var(--amber-bright);
}

/* Batch History */
.batch-list {
    margin-top: 20px;
}
.batch-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    background: var(--bg-dark);
    border-radius: 10px;
    margin-bottom: 10px;
}
.batch-info {
    flex: 1;
}
.batch-name {
    font-weight: 700;
    color: var(--cream);
    margin-bottom: 5px;
}
.batch-details {
    font-size: 0.75rem;
    color: var(--text-dim);
}
.batch-status {
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 700;
}
.batch-status.curing {
    background: rgba(245,158,11,0.2);
    color: var(--amber);
}
.batch-status.ready {
    background: rgba(0,210,106,0.2);
    color: #00d26a;
}
.cal-btn {
    background: var(--card);
    border: 1px solid var(--card-border);
    border-radius: 6px;
    padding: 4px 8px;
    cursor: pointer;
    font-size: 0.8rem;
    transition: all 0.2s;
}
.cal-btn:hover {
    background: var(--amber);
    border-color: var(--amber);
}

/* Calendar Modal */
.calendar-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    padding: 20px;
}
.calendar-modal-content {
    background: var(--card);
    border: 1px solid var(--card-border);
    border-radius: 16px;
    padding: 30px;
    max-width: 400px;
    width: 100%;
    text-align: center;
}
.calendar-modal-content h3 {
    color: var(--amber);
    margin-bottom: 10px;
}
.calendar-options {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin: 20px 0;
}
.cal-option {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 12px 20px;
    border-radius: 8px;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    border: none;
    font-size: 0.9rem;
    transition: all 0.2s;
}
.cal-option.google {
    background: #4285f4;
    color: white;
}
.cal-option.google:hover { background: #3367d6; }
.cal-option.outlook {
    background: #0078d4;
    color: white;
}
.cal-option.outlook:hover { background: #106ebe; }
.cal-option.apple {
    background: var(--bg-dark);
    color: var(--cream);
    border: 1px solid var(--card-border);
}
.cal-option.apple:hover { background: var(--card-light); }
.cal-close {
    background: transparent;
    border: 1px solid var(--card-border);
    color: var(--cream-dim);
    padding: 8px 20px;
    border-radius: 6px;
    cursor: pointer;
    margin-top: 10px;
}
.cal-close:hover { background: var(--card-light); }

/* Amazon Supplies Bar */
.supplies-bar {
    background: linear-gradient(135deg, var(--card) 0%, var(--bg-dark) 100%);
    border: 1px solid var(--card-border);
    border-radius: 12px;
    padding: 15px 20px;
    margin: 30px 0;
    display: flex;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
}
.supplies-bar-title {
    color: var(--amber);
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
}
.supplies-items {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    flex: 1;
}
.supply-link {
    background: var(--bg-dark);
    border: 1px solid var(--card-border);
    color: var(--cream-dim);
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    text-decoration: none;
    transition: all 0.2s;
    white-space: nowrap;
}
.supply-link:hover {
    background: #ff9900;
    border-color: #ff9900;
    color: #000;
}
.supplies-disclosure {
    font-size: 0.65rem;
    color: var(--text-dim);
    width: 100%;
    margin-top: 5px;
    text-align: center;
}

/* Tips Section */
.tips-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 15px;
    margin-top: 20px;
}
.tip-card {
    background: var(--bg-dark);
    border: 1px solid var(--card-border);
    border-radius: 12px;
    padding: 20px;
}
.tip-icon {
    font-size: 1.5rem;
    margin-bottom: 10px;
}
.tip-title {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--cream);
    margin-bottom: 8px;
}
.tip-text {
    font-size: 0.8rem;
    color: var(--text-dim);
    line-height: 1.5;
}

/* Collapsible Guide */
.guide-container {
    background: var(--card);
    border: 1px solid var(--card-border);
    border-radius: 16px;
    margin-top: 30px;
    overflow: hidden; /* Keeps rounded corners when closed */
}
.guide-container.open {
    overflow: visible; /* Allows sticky tabs to work with page scroll */
}
.guide-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 25px;
    cursor: pointer;
    user-select: none;
    transition: background 0.2s;
    background: var(--card);
    border-radius: 16px 16px 0 0; /* Maintains top corners */
}
.guide-header:hover {
    background: var(--card-light);
}
.guide-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--cream);
}
.guide-toggle {
    font-size: 1.2rem;
    color: var(--cream-dim);
    transition: transform 0.3s;
}
.guide-container.open .guide-toggle {
    transform: rotate(180deg);
}
.guide-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-out;
}
.guide-container.open .guide-content {
    max-height: none;
    overflow: visible;
}
.guide-tabs {
    display: flex;
    gap: 5px;
    padding: 12px 20px;
    background: var(--bg-dark);
    border-bottom: 1px solid var(--card-border);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    /* Sticky tabs - stays visible when scrolling page */
    position: sticky;
    top: 75px; /* Below the tool-nav on mobile (single row) */
    z-index: 50;
    margin: 0 -1px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    border-radius: 0; /* Override any inherited radius for clean stick */
}
@media (min-width: 769px) {
    .guide-tabs {
        top: 120px; /* Account for wrapped tool-nav on desktop */
    }
}
.guide-tabs::-webkit-scrollbar { display: none; }
.guide-tab {
    padding: 12px 16px;
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--cream-dim);
    font-size: 0.75rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
    min-width: 80px;
    text-align: center;
}
.guide-tab:hover { color: var(--cream); }
.guide-tab.active {
    color: var(--amber);
    border-bottom-color: var(--amber);
}
.guide-section {
    display: none;
    padding: 20px 25px;
    color: var(--cream-dim);
    font-size: 0.85rem;
    line-height: 1.7;
    background: var(--card); /* Ensures proper background when container overflow is visible */
    border-radius: 0 0 16px 16px; /* Rounded bottom corners */
}
.guide-section.active { display: block; }
.guide-section h4 {
    color: var(--amber);
    font-size: 0.9rem;
    margin: 15px 0 8px 0;
}
.guide-section h4:first-child { margin-top: 0; }
.guide-section ul { margin: 10px 0 10px 20px; }
.guide-section li { margin-bottom: 6px; }
.guide-section code {
    background: var(--bg-dark);
    padding: 2px 6px;
    border-radius: 3px;
    font-family: monospace;
    font-size: 0.8rem;
    color: var(--amber-bright);
}
.guide-section .formula {
    background: var(--bg-dark);
    border-left: 3px solid var(--amber);
    padding: 12px 15px;
    margin: 15px 0;
    border-radius: 0 8px 8px 0;
    font-family: monospace;
    color: var(--amber-bright);
}

/* Footer */
.app-footer {
    text-align: center;
    padding: 30px 20px;
    margin-top: 40px;
    border-top: 1px solid var(--card-border);
    color: var(--text-dim);
    font-size: 0.8rem;
}
.app-footer a {
    color: var(--amber);
    text-decoration: none;
}
.app-footer a:hover {
    text-decoration: underline;
}
.made-with-love {
    font-size: 0.75rem;
    color: var(--cream-dim);
    margin-top: 10px;
    opacity: 0.8;
}

/* Scrollbar */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--bg-dark); }
::-webkit-scrollbar-thumb { background: var(--card-border); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--card-light); }

/* Mobile */
@media (max-width: 600px) {
    .form-grid { grid-template-columns: 1fr; }
    .results-grid { grid-template-columns: repeat(2, 1fr); }
    .recipe-item { grid-template-columns: 1fr 1fr; gap: 8px; }
    .recipe-item input:first-child { grid-column: 1 / -1; }
}

/* Light Mode for Hidden Gems */
body.light-mode {
    background: #f5f5f5 !important;
}
body.light-mode .app-container {
    background: #f5f5f5;
}
body.light-mode .app-header {
    background: #e5e5e5 !important;
    border-color: #ccc !important;
}
body.light-mode .app-title {
    color: #1a1a1a !important;
}
body.light-mode .side-panel {
    background: #e8e8e8 !important;
    border-color: #ccc !important;
}
body.light-mode .mode-tab {
    background: #d5d5d5 !important;
    color: #333 !important;
    border-color: #bbb !important;
}
body.light-mode .mode-tab.active {
    background: var(--green-glow) !important;
    color: #fff !important;
}
body.light-mode .main-content {
    background: #f0f0f0 !important;
}
body.light-mode .calc-display,
body.light-mode .canvas-container,
body.light-mode .art-canvas {
    background: #fff !important;
    border-color: #ccc !important;
}
body.light-mode .calc-btn {
    background: #e5e5e5 !important;
    color: #333 !important;
    border-color: #ccc !important;
}
body.light-mode .calc-btn:hover {
    background: #d5d5d5 !important;
}
body.light-mode .calc-btn.operator {
    background: #ddd !important;
}
body.light-mode .guide-container,
body.light-mode .controls-panel {
    background: #e5e5e5 !important;
    border-color: #ccc !important;
}
body.light-mode .guide-section,
body.light-mode .control-group {
    background: #fff !important;
    border-color: #ddd !important;
}
body.light-mode h3, body.light-mode h4, body.light-mode label {
    color: #1a1a1a !important;
}
body.light-mode p, body.light-mode li, body.light-mode span {
    color: #333 !important;
}
body.light-mode input, body.light-mode select, body.light-mode textarea {
    background: #fff !important;
    border-color: #ccc !important;
    color: #1a1a1a !important;
}
body.light-mode .card, body.light-mode .recipe-card, body.light-mode .wax-card {
    background: #fff !important;
    border-color: #ddd !important;
}
body.light-mode .back-btn {
    color: #555 !important;
}
body.light-mode .header-badge, body.light-mode .missa-badge {
    background: rgba(34, 197, 94, 0.15) !important;
}
body.light-mode .offline-indicator {
    background: #ddd !important;
    color: #333 !important;
}
body.light-mode .preset-btn, body.light-mode .action-btn {
    background: #e5e5e5 !important;
    color: #333 !important;
    border-color: #ccc !important;
}
body.light-mode .preset-btn.active, body.light-mode .action-btn:hover {
    background: var(--green-glow) !important;
    color: #fff !important;
}
body.light-mode .tip-box {
    background: rgba(34, 197, 94, 0.1) !important;
}
body.light-mode .result-display, body.light-mode .result-card {
    background: #f5f5f5 !important;
    border-color: #ddd !important;
}
body.light-mode .result-label {
    color: #555 !important;
}
body.light-mode code {
    background: #e5e5e5 !important;
    color: #333 !important;
}

/* Accessibility: Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    .candle-flame, .candle-glow {
        animation: none !important;
    }
}

/* Safari/iOS animation performance fixes */
@supports (-webkit-touch-callout: none) {
    /* iOS Safari specific - reduce animation complexity to prevent blinking */
    .candle-flame, .candle-flame::before {
        -webkit-transform: translateZ(0);
        transform: translateZ(0);
        -webkit-backface-visibility: hidden;
        backface-visibility: hidden;
        will-change: transform, opacity;
        /* Remove blur on iOS - causes flickering on older devices */
        filter: none !important;
        -webkit-filter: none !important;
    }
    .candle-glow {
        -webkit-transform: translateZ(0);
        transform: translateZ(0);
        will-change: opacity;
    }
    /* Slow down animations on iOS to prevent jank */
    .candle-flame {
        animation-duration: 0.8s !important;
    }
    .candle-flame::before {
        animation-duration: 0.5s !important;
    }
    .candle-glow {
        animation-duration: 3s !important;
    }
    /* Disable header flicker animation on iOS */
    .app-header::before {
        animation: none !important;
        opacity: 0.6 !important;
    }
}

/* Extra aggressive fixes for older iOS devices (iPhone X, 11, 12 series) */
@media screen and (max-width: 428px) {
    @supports (-webkit-touch-callout: none) {
        /* Completely disable complex animations on smaller iOS screens */
        .candle-flame {
            animation: none !important;
            filter: none !important;
            -webkit-filter: none !important;
        }
        .candle-flame::before {
            animation: none !important;
        }
        .candle-glow {
            animation: none !important;
            opacity: 0.6 !important;
        }
        .app-header::before {
            animation: none !important;
            opacity: 0.5 !important;
        }
        /* Reduce any remaining will-change to prevent layer explosion */
        .shop-link {
            will-change: auto !important;
        }
    }
}

/* ═══════════════════════════════════════════════════════════════════════════════
   BUDGET PANEL STYLES - Fudget-style for Marissa
   ═══════════════════════════════════════════════════════════════════════════════ */

.budget-balance-card {
    text-align: center;
    padding: 30px 20px;
    background: linear-gradient(135deg, var(--card) 0%, var(--card-light) 100%);
    border: 1px solid var(--card-border);
    border-radius: 16px;
    margin-bottom: 16px;
}

/* Budget Selector */
.budget-selector {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
}

.budget-selector select {
    flex: 1;
    padding: 12px 14px;
    border: 1px solid var(--card-border);
    border-radius: 10px;
    background: var(--card);
    color: var(--cream);
    font-size: 1rem;
    cursor: pointer;
}

.budget-selector select:focus {
    outline: none;
    border-color: var(--amber);
}

.budget-new-btn {
    padding: 12px 16px;
    border: 1px solid var(--amber);
    border-radius: 10px;
    background: transparent;
    color: var(--amber);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
}

.budget-new-btn:hover {
    background: var(--amber);
    color: #1a1a1a;
}

.budget-delete-btn {
    padding: 12px 14px;
    border: 1px solid var(--card-border);
    border-radius: 10px;
    background: var(--card);
    color: var(--text-dim);
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.15s;
}

.budget-delete-btn:hover {
    border-color: var(--flame-red);
    color: var(--flame-red);
}

.budget-balance-label {
    font-size: 0.85rem;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 8px;
}

.budget-balance-amount {
    font-size: 3.5rem;
    font-weight: 800;
    color: var(--cream);
    line-height: 1;
    font-family: 'Playfair Display', Georgia, 'Times New Roman', serif;
}

.budget-balance-amount.negative { color: var(--flame-red); }
.budget-balance-amount.positive { color: var(--amber-bright); }

.budget-add-btns {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 16px;
}

.budget-add-btn {
    padding: 16px;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: all 0.15s;
}

.budget-add-btn.expense {
    background: linear-gradient(135deg, #7f1d1d 0%, #991b1b 100%);
    color: #fecaca;
}

.budget-add-btn.expense:hover {
    background: linear-gradient(135deg, #991b1b 0%, #b91c1c 100%);
}

.budget-add-btn.income {
    background: linear-gradient(135deg, var(--amber-dim) 0%, var(--amber) 100%);
    color: #fffbeb;
}

.budget-add-btn.income:hover {
    background: linear-gradient(135deg, var(--amber) 0%, var(--amber-bright) 100%);
}

.budget-entries {
    background: var(--card);
    border: 1px solid var(--card-border);
    border-radius: 16px;
    overflow: hidden;
    margin-bottom: 16px;
}

.budget-entries-header {
    padding: 12px 16px;
    border-bottom: 1px solid var(--card-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 600;
    color: var(--cream-dim);
}

.budget-clear-btn {
    font-size: 0.75rem;
    color: var(--text-dim);
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 6px;
}

.budget-clear-btn:hover {
    background: var(--card-light);
    color: var(--flame-red);
}

.budget-entries-list {
    max-height: 400px;
    overflow-y: auto;
}

.budget-entry {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 16px;
    border-bottom: 1px solid var(--card-border);
}

.budget-entry:last-child { border-bottom: none; }

.budget-entry-left { flex: 1; min-width: 0; }

.budget-entry-name {
    font-weight: 500;
    color: var(--cream);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.budget-entry-meta {
    font-size: 0.75rem;
    color: var(--text-dim);
    margin-top: 2px;
}

.budget-entry-amount {
    font-weight: 600;
    font-size: 1.1rem;
    margin-left: 10px;
}

.budget-entry-amount.expense { color: var(--flame-red); }
.budget-entry-amount.income { color: var(--amber-bright); }

.budget-entry-delete {
    background: none;
    border: none;
    color: var(--text-dim);
    cursor: pointer;
    padding: 5px;
    margin-left: 8px;
    opacity: 0.5;
    font-size: 1rem;
}

.budget-entry-delete:hover {
    opacity: 1;
    color: var(--flame-red);
}

.budget-date-divider {
    padding: 8px 16px;
    background: var(--card-light);
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.budget-empty {
    padding: 40px 20px;
    text-align: center;
    color: var(--text-dim);
}

.budget-empty-icon {
    font-size: 3rem;
    margin-bottom: 10px;
}

.budget-stats-card {
    background: var(--card);
    border: 1px solid var(--card-border);
    border-radius: 16px;
    padding: 16px;
    margin-bottom: 16px;
}

.budget-stats-title {
    font-weight: 600;
    color: var(--cream-dim);
    margin-bottom: 12px;
}

.budget-stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

.budget-stat { text-align: center; }

.budget-stat-label {
    font-size: 0.7rem;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

.budget-stat-value {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--cream);
}

.budget-stat-value.expense { color: var(--flame-red); text-shadow: 0 0 20px rgba(248,113,113,0.3); }
.budget-stat-value.income { color: var(--amber-bright); text-shadow: 0 0 20px var(--amber-glow); }
/* Profit totals get monospace for that money feel */
#missa-budget-profit, #missa-total-profit { font-family: 'SF Mono', 'Fira Code', ui-monospace, monospace; }

.budget-backup-card {
    background: var(--card);
    border: 1px solid var(--card-border);
    border-radius: 16px;
    padding: 16px;
}

.budget-backup-title {
    font-weight: 600;
    color: var(--cream-dim);
    margin-bottom: 6px;
}

.budget-backup-status {
    font-size: 0.85rem;
    color: var(--text-dim);
    margin-bottom: 12px;
}

.budget-backup-btns {
    display: flex;
    gap: 10px;
}

.budget-backup-btn {
    flex: 1;
    padding: 12px;
    border: 1px solid var(--card-border);
    border-radius: 10px;
    background: var(--card-light);
    color: var(--cream-dim);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s;
}

.budget-backup-btn:hover {
    border-color: var(--amber);
    background: var(--card);
    color: var(--amber);
}

/* Budget Modal */
.budget-modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.7);
    z-index: 10000;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.budget-modal-overlay.open { display: flex; }

.budget-modal {
    background: var(--card);
    width: 100%;
    max-width: 500px;
    border-radius: 16px;
    padding: 20px;
    max-height: calc(100vh - 40px);
    overflow-y: auto;
    border: 1px solid var(--card-border);
}

.budget-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.budget-modal-title {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--cream);
}

.budget-modal-close {
    background: none;
    border: none;
    font-size: 1.8rem;
    color: var(--text-dim);
    cursor: pointer;
    padding: 5px;
    line-height: 1;
}

.budget-form-group {
    margin-bottom: 16px;
}

.budget-form-group label {
    display: block;
    font-size: 0.8rem;
    color: var(--text-dim);
    margin-bottom: 6px;
}

.budget-form-group input,
.budget-form-group select {
    width: 100%;
    padding: 14px;
    border: 1px solid var(--card-border);
    border-radius: 10px;
    background: var(--bg-dark);
    color: var(--cream);
    font-size: 1rem;
}

.budget-form-group input:focus,
.budget-form-group select:focus {
    outline: none;
    border-color: var(--amber);
}

.budget-amount-wrap {
    position: relative;
}

.budget-currency {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-dim);
    font-size: 1.2rem;
}

.budget-amount-wrap input {
    padding-left: 30px;
    font-size: 1.5rem;
    font-weight: 600;
}

.budget-submit-btn {
    width: 100%;
    padding: 16px;
    border: none;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    margin-top: 10px;
}

.budget-submit-btn.expense {
    background: linear-gradient(135deg, #dc2626 0%, #ef4444 100%);
    color: white;
}

.budget-submit-btn.income {
    background: linear-gradient(135deg, var(--amber) 0%, var(--amber-bright) 100%);
    color: #1a1a1a;
}

.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}
.header-nav{display:-webkit-flex;display:flex;-webkit-align-items:center;align-items:center;gap:8px}
.back-arrow{display:-webkit-flex;display:flex;-webkit-align-items:center;align-items:center;-webkit-justify-content:center;justify-content:center;width:32px;height:32px;border-radius:8px;background:#242d3d;color:#9ca3af;text-decoration:none;font-size:1.1rem}
.home-logo{display:-webkit-flex;display:flex;-webkit-align-items:center;align-items:center}
.home-logo svg{width:28px;height:28px}

/* ═══════════════════════════════════════════════════════════════════════════════
   INVENTORY TRACKER STYLES
   ═══════════════════════════════════════════════════════════════════════════════ */

.inventory-add-card {
    background: var(--card);
    border: 1px solid var(--card-border);
    border-radius: 16px;
    padding: 20px;
    margin-bottom: 20px;
}

.inventory-add-header {
    color: var(--cream);
    font-weight: 600;
    margin-bottom: 15px;
    font-size: 1.1rem;
}

.inventory-alerts {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.15) 0%, rgba(251, 146, 60, 0.1) 100%);
    border: 1px solid var(--amber-dim);
    border-radius: 12px;
    padding: 15px;
    margin-bottom: 20px;
}

.inventory-alerts-header {
    color: var(--amber-bright);
    font-weight: 600;
    margin-bottom: 10px;
}

.inventory-alerts-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.inventory-alert-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(0,0,0,0.2);
    padding: 10px 12px;
    border-radius: 8px;
    font-size: 0.9rem;
}

.inventory-alert-name {
    color: var(--cream);
}

.inventory-alert-qty {
    color: var(--amber-bright);
    font-weight: 600;
}

.inventory-list-card {
    background: var(--card);
    border: 1px solid var(--card-border);
    border-radius: 16px;
    padding: 20px;
    margin-bottom: 20px;
}

.inventory-list-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: var(--cream);
    font-weight: 600;
    margin-bottom: 15px;
}

.inventory-filter {
    display: flex;
    gap: 10px;
}

.inventory-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.inventory-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--card-light);
    border: 1px solid var(--card-border);
    border-radius: 10px;
    padding: 12px 15px;
}

.inventory-item.low-stock {
    border-color: var(--amber-dim);
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.08) 0%, var(--card-light) 100%);
}

.inventory-item-info {
    flex: 1;
}

.inventory-item-name {
    color: var(--cream);
    font-weight: 500;
    margin-bottom: 4px;
}

.inventory-item-meta {
    color: var(--text-dim);
    font-size: 0.85rem;
}

.inventory-item-qty {
    display: flex;
    align-items: center;
    gap: 8px;
}

.inventory-qty-value {
    color: var(--amber-bright);
    font-weight: 600;
    font-size: 1.1rem;
    min-width: 60px;
    text-align: center;
}

.inventory-qty-btn {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    border: 1px solid var(--card-border);
    background: var(--card);
    color: var(--cream);
    font-size: 1.2rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.inventory-qty-btn:hover {
    background: var(--amber);
    border-color: var(--amber);
    color: #000;
}

.inventory-item-actions {
    display: flex;
    gap: 8px;
    margin-left: 15px;
}

.inventory-delete-btn {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    border: none;
    background: transparent;
    color: var(--text-dim);
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.inventory-delete-btn:hover {
    color: #f87171;
    background: rgba(248, 113, 113, 0.1);
}

/* ═══════════════════════════════════════════════════════════════════════════════
   BATCH LOG STYLES
   ═══════════════════════════════════════════════════════════════════════════════ */

.batch-rating {
    display: flex;
    gap: 8px;
}

.rating-star {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    border: 1px solid var(--card-border);
    background: var(--card);
    color: var(--text-dim);
    font-size: 1.5rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.rating-star:hover,
.rating-star.active {
    background: var(--amber);
    border-color: var(--amber);
    color: #000;
}

.batch-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.batch-log-item {
    background: var(--card-light);
    border: 1px solid var(--card-border);
    border-radius: 12px;
    padding: 15px;
}

.batch-log-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 10px;
}

.batch-log-title {
    color: var(--cream);
    font-weight: 600;
    font-size: 1.05rem;
}

.batch-log-date {
    color: var(--text-dim);
    font-size: 0.85rem;
}

.batch-log-rating {
    color: var(--amber);
    font-size: 0.9rem;
}

.batch-log-details {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 8px;
    margin-bottom: 10px;
}

.batch-log-detail {
    background: rgba(0,0,0,0.2);
    padding: 8px 10px;
    border-radius: 6px;
}

.batch-log-detail-label {
    color: var(--text-dim);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.batch-log-detail-value {
    color: var(--cream);
    font-size: 0.9rem;
    font-weight: 500;
}

.batch-log-notes {
    color: var(--text-dim);
    font-size: 0.9rem;
    font-style: italic;
    padding-top: 10px;
    border-top: 1px solid var(--card-border);
}

.batch-log-actions {
    display: flex;
    gap: 10px;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--card-border);
}

.batch-action-btn {
    padding: 6px 12px;
    border-radius: 6px;
    border: 1px solid var(--card-border);
    background: var(--card);
    color: var(--cream);
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.batch-action-btn:hover {
    background: var(--amber);
    border-color: var(--amber);
    color: #000;
}

.batch-action-btn.delete:hover {
    background: #f87171;
    border-color: #f87171;
}

/* ═══════════════════════════════════════════════════════════════════════════════
   BACKUP PANEL STYLES
   ═══════════════════════════════════════════════════════════════════════════════ */

.backup-summary-card {
    background: var(--card);
    border: 1px solid var(--card-border);
    border-radius: 16px;
    padding: 20px;
    margin-bottom: 20px;
}

.backup-summary-title {
    color: var(--cream);
    font-weight: 600;
    margin-bottom: 15px;
    font-size: 1.1rem;
}

.backup-summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    gap: 12px;
}

.backup-summary-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    background: var(--card-light);
    border-radius: 10px;
    padding: 15px 10px;
    text-align: center;
}

.backup-icon {
    font-size: 1.5rem;
    margin-bottom: 8px;
}

.backup-label {
    color: var(--text-dim);
    font-size: 0.8rem;
    margin-bottom: 4px;
}

.backup-count {
    color: var(--amber-bright);
    font-size: 1.3rem;
    font-weight: 700;
}

.backup-action-card {
    background: var(--card);
    border: 1px solid var(--card-border);
    border-radius: 16px;
    padding: 20px;
    margin-bottom: 20px;
}

.backup-action-header {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 15px;
}

.backup-action-icon {
    font-size: 2rem;
}

.backup-action-title {
    color: var(--cream);
    font-weight: 600;
    font-size: 1.1rem;
}

.backup-action-desc {
    color: var(--text-dim);
    font-size: 0.9rem;
}

.backup-last {
    color: var(--text-dim);
    font-size: 0.85rem;
    margin-top: 12px;
    text-align: center;
}

.backup-import-options {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 15px;
}

.backup-radio {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--cream);
    cursor: pointer;
}

.backup-radio input[type="radio"] {
    width: 18px;
    height: 18px;
    accent-color: var(--amber);
}

.backup-danger-card {
    background: linear-gradient(135deg, rgba(248, 113, 113, 0.1) 0%, var(--card) 100%);
    border: 1px solid rgba(248, 113, 113, 0.3);
    border-radius: 16px;
    padding: 20px;
}

.backup-danger-header {
    color: #f87171;
    font-weight: 600;
    margin-bottom: 10px;
}

.backup-danger-desc {
    color: var(--text-dim);
    font-size: 0.9rem;
    margin-bottom: 15px;
}

.backup-danger-btn {
    padding: 10px 20px;
    border-radius: 8px;
    border: 1px solid #f87171;
    background: transparent;
    color: #f87171;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.backup-danger-btn:hover {
    background: #f87171;
    color: #000;
}

/* ═══════════════════════════════════════════════════════════════════════════════
   TABLE OF CONTENTS
═══════════════════════════════════════════════════════════════════════════════ */

.toc-container {
    background: var(--card-dark);
    border: 1px solid var(--card-border);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 30px;
}

.toc-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    cursor: pointer;
}

.toc-title {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 1.1rem;
    color: var(--cream);
    margin: 0;
}

.toc-toggle {
    color: var(--amber);
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 5px;
}

.toc-toggle-icon {
    transition: transform 0.3s ease;
}

.toc-container.collapsed .toc-toggle-icon {
    transform: rotate(-90deg);
}

.toc-container.collapsed .toc-list {
    display: none;
}

.toc-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 8px 20px;
    list-style: none;
    padding: 0;
    margin: 0;
}

.toc-item {
    margin: 0;
}

.toc-link {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: var(--card);
    border-radius: 8px;
    color: var(--cream-dim);
    text-decoration: none;
    font-size: 0.8rem;
    transition: all 0.2s ease;
    border: 1px solid transparent;
}

.toc-link:hover {
    background: var(--card-light);
    border-color: var(--amber);
    color: var(--cream);
}

.toc-link .toc-icon {
    font-size: 1rem;
    flex-shrink: 0;
}

.toc-link .toc-text {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.toc-section-group {
    margin-bottom: 15px;
}

.toc-section-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--amber);
    margin-bottom: 8px;
    padding-left: 12px;
    font-weight: 600;
}

/* Scroll target offset for sticky nav */
.science-section {
    scroll-margin-top: 80px;
}

@media (max-width: 768px) {
    .toc-list {
        grid-template-columns: 1fr;
    }
    
    .toc-link {
        font-size: 0.75rem;
        padding: 10px 12px;
    }
}

/* Difficulty badges */
.difficulty-badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    margin-left: 10px;
}

.difficulty-beginner {
    background: rgba(34, 197, 94, 0.2);
    color: #00d26a;
}

.difficulty-intermediate {
    background: rgba(251, 191, 36, 0.2);
    color: #fbbf24;
}

.difficulty-advanced {
    background: rgba(239, 68, 68, 0.2);
    color: #ef4444;
}

/* Time estimate badges */
.time-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.65rem;
    background: rgba(139, 92, 246, 0.2);
    color: #a78bfa;
    margin-left: 8px;
}

/* Cross-reference links */
.cross-ref-box {
    margin-top: 20px;
    padding: 12px 15px;
    background: rgba(251, 191, 36, 0.1);
    border-left: 3px solid var(--amber);
    border-radius: 0 8px 8px 0;
    font-size: 0.8rem;
}

.cross-ref-box strong {
    color: var(--amber);
}

.cross-ref-box a {
    color: var(--cream);
    text-decoration: underline;
    text-underline-offset: 2px;
}

.cross-ref-box a:hover {
    color: var(--amber);
}

/* ========== PROFESSIONAL GRADE ADDITIONS ========== */

/* ===== TOAST NOTIFICATIONS ===== */
.toast-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
}
.toast {
    background: var(--card);
    border: 1px solid var(--card-border);
    border-radius: 10px;
    padding: 14px 20px;
    color: var(--cream);
    font-size: 0.875rem;
    font-weight: 500;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
    display: flex;
    align-items: center;
    gap: 10px;
    pointer-events: auto;
    animation: toastIn 0.3s ease;
    max-width: 320px;
}
.toast.toast-success {
    border-left: 4px solid var(--green, #00d26a);
}
.toast.toast-error {
    border-left: 4px solid var(--flame-red, #ef4444);
}
.toast.toast-info {
    border-left: 4px solid var(--amber);
}
.toast.toast-out {
    animation: toastOut 0.3s ease forwards;
}
.toast-icon {
    font-size: 1.1rem;
    flex-shrink: 0;
}
.toast-message {
    flex: 1;
}
.toast-close {
    background: none;
    border: none;
    color: var(--cream-dim);
    cursor: pointer;
    padding: 4px;
    font-size: 1rem;
    opacity: 0.7;
    transition: opacity 0.2s;
}
.toast-close:hover {
    opacity: 1;
}
@keyframes toastIn {
    from { opacity: 0; transform: translateX(100px); }
    to { opacity: 1; transform: translateX(0); }
}
@keyframes toastOut {
    from { opacity: 1; transform: translateX(0); }
    to { opacity: 0; transform: translateX(100px); }
}

/* ===== FOCUS STATES (Accessibility) ===== */
/* Universal focus ring for keyboard navigation */
.calc-btn:focus-visible,
.add-btn:focus-visible,
.remove-btn:focus-visible,
.tool-nav-btn:focus-visible,
.guide-tab:focus-visible,
.guide-header:focus-visible,
.toc-link:focus-visible,
button:focus-visible,
a:focus-visible,
[role="button"]:focus-visible {
    outline: 2px solid var(--amber);
    outline-offset: 2px;
}
/* Form elements - already have :focus but ensure :focus-visible */
.form-input:focus-visible,
.form-select:focus-visible,
textarea:focus-visible {
    outline: 2px solid var(--amber);
    outline-offset: 1px;
    border-color: var(--amber);
}
/* Ensure buttons have proper touch targets (44x44 min) */
.calc-btn,
.add-btn,
.remove-btn {
    min-height: 44px;
    min-width: 44px;
}

/* ===== UNIT TOGGLE ===== */
.unit-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.8rem;
    color: var(--cream-dim);
}
.unit-toggle-label {
    font-weight: 600;
}
.unit-toggle-switch {
    position: relative;
    width: 60px;
    height: 28px;
    background: var(--card-dark);
    border: 1px solid var(--card-border);
    border-radius: 14px;
    cursor: pointer;
    transition: all 0.3s;
}
.unit-toggle-switch::before {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    width: 20px;
    height: 20px;
    background: var(--cream-dim);
    border-radius: 50%;
    transition: all 0.3s;
}
.unit-toggle-switch.metric::before {
    left: 35px;
    background: var(--amber);
}
.unit-toggle-switch .unit-f,
.unit-toggle-switch .unit-c {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.65rem;
    font-weight: 700;
    pointer-events: none;
}
.unit-toggle-switch .unit-f {
    left: 8px;
    color: var(--cream);
}
.unit-toggle-switch .unit-c {
    right: 8px;
    color: var(--cream-dim);
}
.unit-toggle-switch.metric .unit-f {
    color: var(--cream-dim);
}
.unit-toggle-switch.metric .unit-c {
    color: var(--cream);
}

/* ===== KEYBOARD SHORTCUTS HINT ===== */
.kbd {
    display: inline-block;
    padding: 2px 6px;
    font-size: 0.7rem;
    font-family: ui-monospace, SFMono-Regular, 'SF Mono', Menlo, monospace;
    color: var(--cream-dim);
    background: var(--card-dark);
    border: 1px solid var(--card-border);
    border-radius: 4px;
    box-shadow: inset 0 -1px 0 var(--card-border);
}
.shortcut-hint {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 0.7rem;
    color: var(--text-dim);
    margin-left: auto;
}

/* ===== ACTION BUTTONS GROUP ===== */
.action-buttons {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 20px;
}
.action-buttons .calc-btn {
    flex: 1;
    min-width: 140px;
}
.btn-secondary {
    background: var(--card) !important;
    color: var(--cream) !important;
    box-shadow: none !important;
    border: 1px solid var(--card-border) !important;
}
.btn-secondary:hover {
    background: var(--card-dark) !important;
    border-color: var(--amber-dim) !important;
}

/* ===== RECIPE ACTION ROW ===== */
.recipe-actions {
    display: flex;
    gap: 8px;
    margin-top: 10px;
    flex-wrap: wrap;
}
.recipe-action-btn {
    flex: 0 0 auto;
    padding: 8px 12px;
    background: var(--card-dark);
    border: 1px solid var(--card-border);
    border-radius: 6px;
    color: var(--cream-dim);
    font-size: 0.7rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 5px;
    min-height: 36px;
}
.recipe-action-btn:hover {
    background: var(--card);
    border-color: var(--amber-dim);
    color: var(--cream);
}
.recipe-action-btn:focus-visible {
    outline: 2px solid var(--amber);
    outline-offset: 2px;
}

/* ===== INVENTORY CHECK BADGE ===== */
.inventory-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 600;
}
.inventory-badge.in-stock {
    background: rgba(34, 197, 94, 0.15);
    color: #00d26a;
}
.inventory-badge.low-stock {
    background: rgba(251, 191, 36, 0.15);
    color: #fbbf24;
}
.inventory-badge.out-of-stock {
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
}

/* ===== CONNECTED TOOL BUTTON ===== */
.tool-connector {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: linear-gradient(135deg, var(--card-dark) 0%, var(--card) 100%);
    border: 1px solid var(--card-border);
    border-radius: 10px;
    margin-top: 15px;
}
.tool-connector-label {
    font-size: 0.8rem;
    color: var(--cream-dim);
    font-weight: 500;
}
.tool-connector-btn {
    padding: 8px 14px;
    background: var(--amber);
    border: none;
    border-radius: 6px;
    color: #000;
    font-size: 0.75rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 6px;
    min-height: 36px;
}
.tool-connector-btn:hover {
    background: var(--amber-bright);
    transform: translateY(-1px);
}
.tool-connector-btn:focus-visible {
    outline: 2px solid var(--cream);
    outline-offset: 2px;
}

/* ===== UTILITY CLASSES (Replace inline styles) ===== */
/* Margins */
.mt-0 { margin-top: 0 !important; }
.mt-5 { margin-top: 5px !important; }
.mt-10 { margin-top: 10px !important; }
.mt-15 { margin-top: 15px !important; }
.mt-20 { margin-top: 20px !important; }
.mt-30 { margin-top: 30px !important; }
.mb-0 { margin-bottom: 0 !important; }
.mb-10 { margin-bottom: 10px !important; }
.mb-15 { margin-bottom: 15px !important; }
.mb-20 { margin-bottom: 20px !important; }
/* Flex */
.flex { display: flex !important; }
.flex-wrap { flex-wrap: wrap !important; }
.items-center { align-items: center !important; }
.justify-between { justify-content: space-between !important; }
.gap-5 { gap: 5px !important; }
.gap-10 { gap: 10px !important; }
.gap-15 { gap: 15px !important; }
/* Grid */
.grid-full { grid-column: 1 / -1 !important; }
/* Width */
.w-auto { width: auto !important; }
.w-full { width: 100% !important; }
.max-w-500 { max-width: 500px !important; }
/* Display */
.hidden { display: none !important; }
.block { display: block !important; }
/* Colors */
.text-cream { color: var(--cream) !important; }
.text-dim { color: var(--text-dim) !important; }
.text-amber { color: var(--amber) !important; }
.text-white { color: #fff !important; }
/* Font sizes */
.text-xs { font-size: 0.7rem !important; }
.text-sm { font-size: 0.75rem !important; }
.text-base { font-size: 0.875rem !important; }
/* Font weights */
.font-bold { font-weight: 700 !important; }
.font-semibold { font-weight: 600 !important; }
/* Text alignment */
.text-center { text-align: center !important; }
.text-right { text-align: right !important; }
.text-left { text-align: left !important; }
/* Padding */
.p-8 { padding: 8px !important; }
.p-10 { padding: 10px !important; }
.p-15 { padding: 15px !important; }
.p-20 { padding: 20px !important; }
.py-8 { padding-top: 8px !important; padding-bottom: 8px !important; }
.py-10 { padding-top: 10px !important; padding-bottom: 10px !important; }
.px-15 { padding-left: 15px !important; padding-right: 15px !important; }
/* Borders */
.border-card { border: 1px solid var(--card-border) !important; }
.border-b-card { border-bottom: 1px solid var(--card-border) !important; }
.border-dashed-amber { border: 2px dashed var(--amber) !important; }
/* Backgrounds */
.bg-card { background: var(--card) !important; }
.bg-card-dark { background: var(--card-dark) !important; }
/* Border radius */
.rounded { border-radius: 8px !important; }
.rounded-lg { border-radius: 12px !important; }
/* Table cell styles */
.table-cell {
    padding: 10px;
    text-align: center;
    border: 1px solid var(--card-border);
}
.table-cell-sm {
    padding: 8px;
    border: 1px solid var(--card-border);
}
.table-header {
    padding: 10px;
    text-align: center;
    border: 1px solid var(--card-border);
    background: var(--card-dark);
    font-weight: 600;
}
/* Info box */
.info-box {
    background: var(--card-dark);
    border: 2px dashed var(--amber);
    padding: 20px;
    border-radius: 12px;
    margin: 15px 0;
}
/* Tip box */
.tip-box {
    margin-top: 20px;
    padding: 12px 15px;
    background: var(--card-dark);
    border-left: 3px solid var(--amber);
    border-radius: 0 8px 8px 0;
}
/* Row styles for tables */
.row-label {
    padding: 10px 0;
    color: var(--cream);
}
.row-value {
    padding: 10px 0;
    text-align: right;
    color: var(--text-dim);
}
.row-value-highlight {
    padding: 10px 0;
    text-align: right;
    color: var(--amber);
}
/* Screen reader only */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ===== SETTINGS BAR ===== */
.settings-bar {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 20px;
    padding: 10px 0;
    margin-bottom: 10px;
    border-bottom: 1px solid var(--card-border);
}
@media (max-width: 600px) {
    .settings-bar {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
}

/* ===== LOAD RECIPE DROPDOWN ===== */
.load-recipe-dropdown {
    width: 100%;
    max-width: 300px;
    padding: 10px 14px;
    background: var(--card-dark);
    border: 1px solid var(--card-border);
    border-radius: 8px;
    color: var(--cream);
    font-size: 0.85rem;
}
.load-recipe-dropdown:focus {
    border-color: var(--amber);
    outline: none;
}

/* ========== PRINT STYLES ========== */
@media print {
    /* Reset colors for printing */
    * {
        background: white !important;
        color: black !important;
        box-shadow: none !important;
        text-shadow: none !important;
    }
    
    /* Hide non-essential elements */
    .tool-nav,
    .candle-icon,
    .missa-badge,
    .missa-unicorn,
    .calc-btn,
    .add-btn,
    .remove-btn,
    .guide-toggle,
    .skip-link,
    .tip-card,
    .cross-ref-box a,
    button,
    input,
    select,
    textarea,
    .toc-toggle,
    noscript,
    script {
        display: none !important;
    }
    
    /* Show all panels for printing */
    .tool-panel {
        display: block !important;
        page-break-inside: avoid;
        margin-bottom: 20px;
        padding: 15px;
        border: 1px solid #ccc;
    }
    
    /* Page setup */
    @page {
        margin: 0.75in;
        size: letter;
    }
    
    /* Headers */
    .app-title {
        font-size: 24pt !important;
        text-align: center;
        margin-bottom: 10px;
    }
    
    .app-subtitle {
        text-align: center;
        font-size: 12pt;
        margin-bottom: 20px;
    }
    
    h2, .tool-title {
        font-size: 16pt !important;
        border-bottom: 2px solid black;
        padding-bottom: 5px;
        margin-top: 20px;
    }
    
    h3 {
        font-size: 14pt !important;
        margin-top: 15px;
        page-break-after: avoid;
    }
    
    h4 {
        font-size: 12pt !important;
        margin-top: 10px;
        page-break-after: avoid;
    }
    
    /* Body text */
    p, li {
        font-size: 10pt !important;
        line-height: 1.4 !important;
    }
    
    /* Lists */
    ul, ol {
        margin-left: 20px;
    }
    
    li {
        margin-bottom: 3px;
    }
    
    /* Science sections */
    .science-section {
        page-break-inside: avoid;
        border: 1px solid #ddd;
        padding: 10px;
        margin-bottom: 15px;
    }
    
    /* Formulas */
    .formula, .formula-box {
        border: 1px solid black;
        padding: 8px;
        margin: 10px 0;
        font-family: 'Courier New', monospace;
        font-size: 9pt;
        background: #f5f5f5 !important;
    }
    
    /* Tables */
    table {
        border-collapse: collapse;
        width: 100%;
        margin: 10px 0;
        font-size: 9pt;
    }
    
    th, td {
        border: 1px solid black !important;
        padding: 5px;
        text-align: left;
    }
    
    th {
        background: #eee !important;
        font-weight: bold;
    }
    
    /* Info sections */
    .info-section {
        page-break-inside: avoid;
        margin-bottom: 15px;
    }
    
    /* Guide steps */
    .guide-step {
        page-break-inside: avoid;
        border: 1px solid #ccc;
        padding: 10px;
        margin-bottom: 10px;
    }
    
    .step-number {
        font-weight: bold;
        font-size: 14pt;
        float: left;
        margin-right: 10px;
        border: 2px solid black;
        border-radius: 50%;
        width: 30px;
        height: 30px;
        text-align: center;
        line-height: 26px;
    }
    
    /* Difficulty badges */
    .difficulty-badge {
        border: 1px solid black;
        padding: 2px 6px;
        font-size: 8pt;
        border-radius: 3px;
    }
    
    /* Time badges */
    .time-badge {
        border: 1px solid black;
        padding: 2px 6px;
        font-size: 8pt;
    }
    
    /* Cross-references - show as text only */
    .cross-ref-box {
        border-top: 1px dashed #999;
        padding-top: 5px;
        margin-top: 10px;
        font-size: 9pt;
        font-style: italic;
    }
    
    /* Print-specific templates - keep white bg */
    .guide-step div[style*="background: #fff"],
    div[style*="background: #fff"] {
        background: white !important;
        border: 1px solid black !important;
    }
    
    /* Wax type cards */
    .wax-type-card {
        border: 1px solid #ccc;
        padding: 8px;
        margin-bottom: 8px;
        page-break-inside: avoid;
    }
    
    /* Links - show URL */
    a[href]:after {
        content: " (" attr(href) ")";
        font-size: 8pt;
        color: #666 !important;
    }
    
    /* Don't show URL for internal links */
    a[href^="#"]:after {
        content: "";
    }
    
    /* TOC - format nicely for print */
    .toc-container {
        border: 1px solid black;
        padding: 10px;
        margin-bottom: 20px;
    }
    
    .toc-list {
        display: block !important;
        column-count: 2;
    }
    
    .toc-link {
        display: block;
        font-size: 9pt;
        margin-bottom: 3px;
    }
    
    /* Hide emojis in section titles for cleaner print */
    h3 .icon,
    .step-number + .step-content h3::first-letter {
        /* Keep emojis but they'll print as text */
    }
    
    /* Page breaks */
    .tool-panel h2 {
        page-break-before: always;
    }
    
    .tool-panel:first-of-type h2 {
        page-break-before: avoid;
    }
    
    /* Print footer */
    body::after {
        content: "Printed from Missa Candle Making Studio — resellmode.com/missa.html";
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        text-align: center;
        font-size: 8pt;
        color: #999 !important;
        padding: 5px;
        border-top: 1px solid #ddd;
    }
}

/* ═══════════════════════════════════════════════════════════════════════════════
   UTILITY CLASSES (v3.10.2) - Replaces inline styles for consistency
   ═══════════════════════════════════════════════════════════════════════════════ */

/* Card variants */
.u-card-flat { background: var(--card); color: var(--cream); box-shadow: none; }
.u-card-gradient { margin-top: 30px; background: linear-gradient(135deg, var(--card-dark) 0%, var(--card) 100%); border: 1px solid var(--amber-dim); }

/* Typography helpers */
.u-text-dim { color: var(--text-dim); }
.u-text-dim-sm { font-size: 0.8rem; color: var(--text-dim); margin-bottom: 10px; }
.u-text-dim-mb { color: var(--text-dim); margin-bottom: 20px; }
.u-text-amber { color: var(--amber); }
.u-text-amber-mb { color: var(--amber); margin-bottom: 15px; }
.u-text-center-italic { text-align: center; margin-top: 10px; font-style: italic; }

/* Spacing */
.u-mt-8 { margin-top: 8px; margin-bottom: 0; }
.u-mt-20 { margin-top: 20px; }
.u-mt-30 { margin-top: 30px; }
.u-mb-15 { margin-bottom: 15px; }

/* Width helpers */
.u-w-auto-140 { width: auto; min-width: 140px; }
.u-w-auto-180 { width: auto; min-width: 180px; }

/* Tables */
.u-table-sm { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
.u-table-xs { width: 100%; border-collapse: collapse; font-size: 0.8rem; margin: 10px 0; }

/* Print preview */
.u-print-preview { background: #fff; color: #000; padding: 20px; border-radius: 8px; font-family: 'Courier New', monospace; font-size: 11px; line-height: 1.8; }
.u-print-header { font-weight: bold; font-size: 14px; text-align: center; margin-bottom: 15px; border-bottom: 2px solid #000; padding-bottom: 10px; }

/* Flex helpers */
.u-flex-gap-10 { display: flex; gap: 10px; }
.u-flex-gap-15 { gap: 15px; }

/* Display */
.u-hidden { display: none; }
.u-max-400 { max-width: 400px; }
.u-max-500 { max-width: 500px; }
.u-grid-full { grid-column: 1 / -1; }
