body {
    font-family: sans-serif;
    margin: 0;
    background: #f0f2f5;
}

.main-container {
    display: flex;
    width: 100%;
    height: 100vh;
    overflow: hidden;
}

.canvas-wrapper {
    flex-grow: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    overflow: auto;
}

#canvas-container {
    position: relative; /* ЭТО ГЛАВНОЕ ПРАВИЛО. ВСЕ ПОЛЯ БУДУТ ВНУТРИ НЕГО. */
    line-height: 0; /* Технический фикс для удаления отступов */
    box-shadow: 0 0 15px rgba(0,0,0,0.2);
}

#canvas-container img {
    display: block;
    max-width: 100%;
    max-height: 90vh;
}

.toolbar {
    width: 300px;
    min-width: 300px;
    background: #fff;
    padding: 20px;
    overflow-y: auto;
    border-left: 1px solid #ddd;
}

/* СТИЛИ ПЕРЕТАСКИВАЕМОГО ПОЛЯ С ИСПОЛЬЗОВАНИЕМ TOP/LEFT */
.draggable-field {
    position: absolute; /* Позиционируется относительно #canvas-container */
    cursor: move;
    padding: 5px;
    border: 1px dashed #3498db;
    white-space: nowrap;
    user-select: none;
    line-height: normal;
}

.draggable-field.selected {
    border: 2px solid #e74c3c;
    z-index: 100;
}

/* Остальные стили тулбара */
.toolbar-section { margin-bottom: 25px; border-bottom: 1px solid #eee; padding-bottom: 25px; }
h3 { margin-top: 0; }
label { display: block; margin-bottom: 10px; }
input, select { width: 100%; margin-bottom: 10px; padding: 5px; box-sizing: border-box; }
.tool-btn { width: 100%; margin-bottom: 5px; padding: 8px; cursor: pointer; }
#fields-from-excel button { background-color: #eafaf1; border: 1px solid #2ecc71; }
.generate-button { padding: 15px; font-size: 16px; background-color: #27ae60; color: white; cursor: pointer; border: none; }
#status { margin-top: 10px; padding: 10px; border-radius: 5px; text-align: center; }
.status-error { background: #fbeae5; border: 1px solid #c0392b; }
.status-wait { background: #e6f7ff; border: 1px solid #3498db; }
