* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #1a1a1a;
    color: #e0e0e0;
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

header {
    background: #111;
    padding: 12px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid #333;
    flex-shrink: 0;
}

header h1 {
    font-size: 18px;
    font-weight: 600;
    color: #fff;
}

#steps-nav {
    display: flex;
    gap: 8px;
}

.step-indicator {
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 13px;
    background: #2a2a2a;
    color: #888;
    cursor: default;
}

.step-indicator.active {
    background: #c8a96e;
    color: #111;
    font-weight: 600;
}

.step-indicator.done {
    background: #3a5a3a;
    color: #8fc98f;
}

/* Layout */
#app {
    display: flex;
    flex: 1;
    overflow: hidden;
}

#sidebar {
    width: 280px;
    min-width: 280px;
    background: #222;
    border-right: 1px solid #333;
    overflow-y: auto;
    padding: 16px;
}

#main {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #2a2a2a;
    position: relative;
    overflow: hidden;
}

canvas#canvas {
    display: block;
}

#canvas3d {
    display: none;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

/* Panels */
.panel {
    display: none;
}

.panel.active {
    display: block;
}

.panel h2 {
    font-size: 16px;
    margin-bottom: 12px;
    color: #c8a96e;
}

.panel h3 {
    font-size: 13px;
    margin: 14px 0 8px;
    color: #aaa;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Slab gallery */
#slab-gallery {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
    margin-bottom: 14px;
}

.slab-thumb {
    aspect-ratio: 300 / 230;
    border: 2px solid transparent;
    border-radius: 4px;
    cursor: pointer;
    overflow: hidden;
    background: #333;
}

.slab-thumb.selected {
    border-color: #c8a96e;
}

.slab-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Buttons */
.btn-primary {
    display: block;
    width: 100%;
    padding: 10px;
    margin-top: 12px;
    background: #c8a96e;
    color: #111;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
}

.btn-primary:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.btn-secondary {
    display: block;
    width: 100%;
    padding: 8px;
    margin-top: 8px;
    background: #444;
    color: #e0e0e0;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    cursor: pointer;
}

.btn-back {
    display: block;
    width: 100%;
    padding: 8px;
    margin-top: 6px;
    background: none;
    color: #888;
    border: 1px solid #444;
    border-radius: 6px;
    font-size: 13px;
    cursor: pointer;
}

/* Grid fill button */
.btn-grid {
    display: block;
    width: 100%;
    padding: 9px;
    margin-top: 8px;
    background: linear-gradient(135deg, #4a6a4a, #3a5a3a);
    color: #c8eec8;
    border: 1px solid #5a8a5a;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    letter-spacing: 0.3px;
}

/* Preset buttons */
#preset-cuts {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
}

.btn-preset {
    padding: 8px 4px;
    background: #3a3a3a;
    color: #ddd;
    border: 1px solid #555;
    border-radius: 4px;
    font-size: 12px;
    cursor: pointer;
}

/* Kerf setting */
#kerf-setting {
    margin-bottom: 4px;
}

#kerf-setting label {
    display: flex;
    flex-direction: column;
    font-size: 12px;
    color: #999;
    gap: 3px;
}

/* Custom cut form */
#custom-cut {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

#custom-cut label,
#surface-dims label {
    display: flex;
    flex-direction: column;
    font-size: 12px;
    color: #999;
    gap: 3px;
}

input[type="number"] {
    padding: 6px 8px;
    background: #333;
    border: 1px solid #555;
    border-radius: 4px;
    color: #e0e0e0;
    font-size: 14px;
    width: 100%;
}

input[type="number"]:focus {
    outline: none;
    border-color: #c8a96e;
}

/* Cuts list */
#cuts-list {
    list-style: none;
    max-height: 160px;
    overflow-y: auto;
}

#cuts-list li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 8px;
    margin-bottom: 3px;
    background: #333;
    border-radius: 4px;
    font-size: 13px;
}

#cuts-list li .cut-info {
    display: flex;
    align-items: center;
    gap: 6px;
}

#cuts-list li .cut-preview {
    width: 24px;
    height: 24px;
    border-radius: 2px;
    border: 1px solid #555;
}

#cuts-list li .btn-remove {
    background: none;
    border: none;
    color: #f66;
    cursor: pointer;
    font-size: 16px;
    padding: 0 4px;
    line-height: 1;
}

#surface-dims {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

/* Placement pieces */
#placement-pieces {
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-height: 400px;
    overflow-y: auto;
}

.placement-piece {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 8px;
    background: #333;
    border-radius: 4px;
    cursor: grab;
}

.placement-piece.placed {
    opacity: 0.4;
    cursor: default;
}

.placement-piece canvas {
    border-radius: 2px;
    border: 1px solid #555;
    flex-shrink: 0;
}

.placement-piece .piece-label {
    font-size: 12px;
    color: #ccc;
}

.placement-piece .piece-actions {
    margin-left: auto;
    display: flex;
    gap: 4px;
}

.placement-piece .piece-actions button {
    background: none;
    border: none;
    color: #aaa;
    cursor: pointer;
    font-size: 14px;
    padding: 2px;
}

.hint {
    font-size: 12px;
    color: #888;
    margin-bottom: 10px;
    font-style: italic;
}

/* 3D render buttons */
.btn-render {
    display: block;
    width: 100%;
    padding: 10px;
    margin-bottom: 6px;
    background: linear-gradient(135deg, #4a4a6a, #3a3a5a);
    color: #c8c8ee;
    border: 1px solid #5a5a8a;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-render:hover {
    background: linear-gradient(135deg, #5a5a7a, #4a4a6a);
}

.btn-render.active {
    background: linear-gradient(135deg, #6a5a3a, #8a6a3a);
    color: #ffe8c0;
    border-color: #c8a96e;
}

/* Display & render options */
#display-options,
#render-options {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

#render-options label {
    display: flex;
    flex-direction: column;
    font-size: 12px;
    color: #999;
    gap: 3px;
}

.toggle-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    cursor: pointer;
}

.toggle-label input[type="checkbox"] {
    accent-color: #c8a96e;
    width: 16px;
    height: 16px;
    cursor: pointer;
}

.color-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.color-row input[type="color"] {
    width: 36px;
    height: 28px;
    border: 1px solid #555;
    border-radius: 4px;
    background: #333;
    cursor: pointer;
    padding: 1px;
}

.color-row span {
    font-size: 12px;
    color: #888;
    font-family: monospace;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: #1a1a1a;
}

::-webkit-scrollbar-thumb {
    background: #555;
    border-radius: 3px;
}
