:root {
    /* --- THE CLEAN CONTRACT: CSS VARIABLES --- */
    /* See SKINNING.md for details */

    /* Semantic Colors */
    --color-primary: #2563eb;
    /* blue-600 */
    --color-primary-hover: #1d4ed8;
    /* blue-700 */
    --color-primary-subtle: #eff6ff;
    /* blue-50 */

    --color-secondary: #10b981;
    /* green-500 */
    --color-secondary-subtle: #ecfdf5;
    /* green-50 */

    --color-accent: #f59e0b;
    /* amber-500 */

    --color-text-main: #1f2937;
    /* gray-800 */
    --color-text-sub: #4b5563;
    /* gray-600 */

    --color-bg-app: #f3f4f6;
    /* gray-100 */
    --color-bg-card: #ffffff;
    /* white */

    --color-border: #e5e7eb;
    /* gray-200 */

    /* Geometry */
    --font-heading: 'Inter', sans-serif;
    --font-body: 'Inter', sans-serif;
    --radius-card: 0.5rem;
    --radius-input: 0.375rem;
    --spacing-base: 1rem;
}

/* Base Styles */
body {
    background-color: var(--color-bg-app);
    color: var(--color-text-main);
    font-family: var(--font-body);
}

h1,
h2,
h3,
h4,
h5,
h6 {
    font-family: var(--font-heading);
}

/* Semantic Classes (Skin Hooks) */
.skin-bg-primary-subtle {
    background-color: var(--color-primary-subtle);
}

.skin-text-primary {
    color: var(--color-primary);
}

.skin-border-primary {
    border-color: var(--color-primary);
}

.skin-bg-secondary-subtle {
    background-color: var(--color-secondary-subtle);
}

.skin-text-secondary {
    color: var(--color-secondary);
}

.skin-border-secondary {
    border-color: var(--color-secondary);
}

.skin-card {
    background-color: var(--color-bg-card);
    border-radius: var(--radius-card);
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
}

/* Form Controls */
.input-label {
    display: block;
    margin-bottom: 0.25rem;
    color: var(--color-text-sub);
    font-weight: 500;
    font-size: 0.875rem;
}

.input-field {
    width: 100%;
    padding: 0.5rem;
    border-radius: var(--radius-input);
    border: 1px solid var(--color-border);
    background-color: #fff;
    /* Could be var, but input bg usually white */
    color: var(--color-text-main);
    transition: border-color 0.2s, box-shadow 0.2s;
    font-size: 0.9rem;
}

.input-field:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.2);
    /* Opacity need special handling or color-mix */
}

/* Buttons */
.btn-primary {
    background-color: var(--color-primary);
    color: white;
    padding: 0.5rem 1.5rem;
    border-radius: var(--radius-input);
    font-weight: 500;
    transition: background-color 0.2s;
    border: none;
    cursor: pointer;
}

.btn-primary:hover {
    background-color: var(--color-primary-hover);
}

/* Scenario Specifics with Variables */
.scenario-header-a {
    border-bottom: 3px solid var(--color-primary);
    color: var(--color-primary-hover);
}

.scenario-box-a {
    background-color: var(--color-primary-subtle);
    border: 1px solid var(--color-primary);
    /* Fallback/Lighten */
    border-color: #bfdbfe;
    /* blue-200 equivalent */
}

.scenario-header-b {
    border-bottom: 3px solid var(--color-secondary);
    color: var(--color-secondary);
}

.scenario-box-b {
    background-color: var(--color-secondary-subtle);
    border: 1px solid var(--color-secondary);
    border-color: #a7f3d0;
    /* green-200 equivalent */
}


/* Insulation Explorer Styles */
:root {
    --insulation-batts: #f4eeb1;
    --insulation-rigid: #a8d5e2;
    --insulation-spray: #fceea7;
    --insulation-radiant: #e0e0e0;
    --structure: #cfb997;
    --air: #f0f8ff;
}

.explorer-container {
    display: grid;
    grid-template-columns: 1fr 350px;
    gap: 20px;
    margin-top: 20px;
}

@media (max-width: 800px) {
    .explorer-container {
        grid-template-columns: 1fr;
    }
}

@media (min-width: 1024px) {
    .grid-cols-1[data-layout="split"] {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .lg\:col-span-2-dynamic[data-layout="split"] {
        grid-column: span 2 / span 2;
    }
}


/* The Visual Stack */
.assembly-stack {
    background: #fff;
    border: 2px solid var(--color-primary);
    border-radius: var(--radius-card);
    padding: 20px;
    min-height: 400px;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
}

.assembly-header {
    text-align: center;
    font-weight: bold;
    color: #666;
    margin-bottom: 10px;
    text-transform: uppercase;
    font-size: 0.8rem;
    border-bottom: 1px dashed #ccc;
    padding-bottom: 5px;
}

.layer {
    position: relative;
    padding: 15px;
    margin-bottom: 2px;
    border: 1px solid #ccc;
    border-radius: 4px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.2s;
    font-family: monospace;
    cursor: grab;
}

.layer:hover {
    transform: scale(1.01);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

/* Layer Types Visualization */
.layer-type-structure {
    background: repeating-linear-gradient(45deg, #deb887, #deb887 10px, #d2a679 10px, #d2a679 20px);
    color: #fff;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

.layer-type-insulation {
    background-color: var(--insulation-batts);
    background-image: url('data:image/svg+xml;utf8,<svg width="20" height="20" xmlns="http://www.w3.org/2000/svg"><path d="M0 10 Q5 0 10 10 T20 10" stroke="%23d4c57e" fill="none"/></svg>');
}

.layer-type-radiant {
    background: linear-gradient(135deg, #e0e0e0 0%, #ffffff 50%, #d6d6d6 100%);
    border: 1px solid #999;
    color: #333;
}

.layer-type-air {
    background: var(--air);
    border: 1px dashed #aad;
    color: #668;
}

.layer-type-sheathing {
    background: #d2b48c;
}

.layer-type-finish {
    background: #fdfdfd;
    border: 1px solid #eee;
}

.layer-controls button {
    background: none;
    border: none;
    cursor: pointer;
    opacity: 0.5;
    font-size: 1.2rem;
    padding: 0 5px;
}

.layer-controls button:hover {
    opacity: 1;
    color: var(--color-primary);
}

/* Controls & Dashboard */
.dashboard {
    background: #f8f9fa;
    border-radius: var(--radius-card);
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    height: fit-content;
}

.stat-card {
    background: white;
    padding: 15px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    text-align: center;
}

.stat-value {
    font-size: 2rem;
    font-weight: bold;
    color: var(--color-primary);
}

.stat-sub {
    font-size: 0.8rem;
    color: #666;
}

.inspector-panel {
    background: #eef;
    border-left: 4px solid var(--color-primary);
    padding: 10px;
    font-size: 0.9rem;
}

.inspector-warning {
    background: #fff3cd;
    border-left: 4px solid #ffc107;
    padding: 10px;
    margin-top: 10px;
    font-size: 0.9rem;
}

.add-menu {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 5px;
}

.add-btn {
    padding: 8px;
    font-size: 0.8rem;
    background: white;
    border: 1px solid #ddd;
    border-radius: 4px;
    cursor: pointer;
    text-align: left;
}

.add-btn:hover {
    background: #f0f0f0;
    border-color: #bbb;
}

.heat-flow-arrow {
    text-align: center;
    font-weight: bold;
    color: var(--color-primary);
    margin: 10px 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}