* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: Inter, Arial, sans-serif;
    background: #f5f7fb;
    color: #333;
}

.page {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

.subscription-banner {
    margin-bottom: 12px;
    padding: 10px 12px;
    border: 1px solid #f0c36d;
    border-radius: 10px;
    background: #fff6e6;
    color: #7a5a1e;
    font-size: 14px;
}

.top-header {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 16px;
    min-height: 48px;
}

.top-header h1 {
    margin: 0;
    font-size: 30px;
    text-align: center;
}

.back-home-btn {
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    border: 1px solid #d8dde6;
    border-radius: 10px;
    background: #fff;
    color: #333;
    font-size: 14px;
    cursor: pointer;
}

.back-home-btn:hover {
    border-color: #7dbf2d;
    background: #f8fbf2;
}

.back-brandmark-icon {
    width: 20px;
    height: 20px;
    object-fit: contain;
}

.mode-bar,
.action-bar {
    display: flex;
    gap: 12px;
    margin-bottom: 12px;
}

.mode-btn,
.action-btn {
    border: 1px solid #d8dde6;
    background: #fff;
    color: #333;
    border-radius: 10px;
    padding: 10px 16px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
}

.mode-btn.active {
    background: #7dbf2d;
    color: #fff;
    border-color: #7dbf2d;
}

.action-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.premium-locked {
    opacity: 0.55;
    cursor: not-allowed;
}

.workspace {
    display: grid;
    grid-template-columns: minmax(320px, 420px) 1fr;
    gap: 16px;
}

.workspace-left {
    display: grid;
    gap: 16px;
}

.workspace-card {
    background: #fff;
    border: 1px solid #e2e7ef;
    border-radius: 12px;
    padding: 16px;
    min-height: 220px;
}

.workspace-card h2 {
    margin: 0 0 12px;
    font-size: 20px;
}

.empty-state {
    color: #7a818d;
    font-size: 15px;
}

.layout-details {
    display: grid;
    gap: 10px;
    font-size: 15px;
}

.room-height-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.room-height-input-wrap {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

#room-height-cm {
    width: 92px;
    border: 1px solid #d5dbe5;
    border-radius: 8px;
    padding: 6px 8px;
    font-size: 14px;
}

.notes-card textarea {
    width: 100%;
    height: 220px;
    border: 1px solid #d5dbe5;
    border-radius: 10px;
    padding: 12px;
    font-size: 15px;
    resize: vertical;
}

.notes-actions {
    margin-top: 10px;
    display: grid;
    gap: 8px;
}

.notes-actions .action-btn {
    width: fit-content;
}

.notes-status {
    min-height: 18px;
    font-size: 13px;
    color: #6b7380;
}

.preview-card {
    min-height: 520px;
    display: flex;
    flex-direction: column;
}

.preview-canvas-wrap,
.preview-3d-wrap {
    flex: 1;
    min-height: 420px;
    border: 1px solid #d5dbe5;
    border-radius: 10px;
    background: #fbfcff;
}

.preview-canvas-wrap {
    position: relative;
    overflow: hidden;
}

#cad-preview-canvas {
    width: 100%;
    height: 100%;
    display: block;
}

.preview-3d-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    color: #6b7380;
    font-size: 16px;
    padding: 20px;
    overflow: hidden;
}

.preview-3d-wrap canvas {
    width: 100%;
    height: 100%;
    display: block;
}

.modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    z-index: 1000;
}

.modal-content {
    width: 100%;
    max-width: 640px;
    max-height: 80vh;
    overflow: auto;
    background: #fff;
    border-radius: 12px;
    padding: 16px;
}

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

.modal-header h3 {
    margin: 0;
}

.close-btn {
    border: none;
    background: transparent;
    font-size: 20px;
    cursor: pointer;
}

.layout-row {
    border: 1px solid #e2e7ef;
    border-radius: 10px;
    padding: 12px;
    margin-bottom: 10px;
}

.layout-row-name {
    font-weight: 700;
    margin-bottom: 6px;
}

.layout-row-meta {
    color: #666;
    font-size: 13px;
    margin-bottom: 8px;
}

.open-row-btn {
    border: none;
    background: #007bff;
    color: #fff;
    border-radius: 8px;
    padding: 8px 12px;
    cursor: pointer;
}

@media (max-width: 900px) {
    .workspace {
        grid-template-columns: 1fr;
    }

    .top-header {
        justify-content: flex-start;
        padding-top: 52px;
        min-height: auto;
    }

    .back-home-btn {
        top: 0;
        transform: none;
    }
}
