* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #f5f6fa;
    min-height: 100vh;
    color: #333;
}

.page {
    min-height: 100vh;
}

/* ========== АВТОРИЗАЦИЯ ========== */
.login-box {
    max-width: 420px;
    margin: 80px auto;
    background: white;
    padding: 40px;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.1);
    text-align: center;
}

.login-box h1 {
    color: #5D4E37;
    margin-bottom: 8px;
    font-size: 32px;
}

.login-box .version {
    font-size: 14px;
    color: #999;
    font-weight: normal;
}

.login-box > p {
    color: #666;
    margin-bottom: 30px;
}

.form-group {
    margin-bottom: 20px;
    text-align: left;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #333;
    font-size: 14px;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 12px 14px;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    font-size: 15px;
    transition: border-color 0.3s;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: #667eea;
}

.error {
    background: #fee;
    color: #c33;
    padding: 12px;
    border-radius: 6px;
    margin-bottom: 15px;
    display: none;
    border-left: 4px solid #c33;
}

.hint {
    margin-top: 25px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 6px;
    font-size: 13px;
    color: #666;
    text-align: left;
}

.hint p {
    margin: 6px 0;
}

.hint strong {
    color: #667eea;
    font-family: monospace;
    background: #eee;
    padding: 2px 6px;
    border-radius: 3px;
}

button {
    width: 100%;
    padding: 14px;
    border: none;
    border-radius: 6px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    margin-bottom: 10px;
}

.btn-secondary {
    background: #f5f5f5;
    color: #333;
    margin-bottom: 10px;
}

.btn-tertiary {
    background: #e8f4fd;
    color: #007bff;
    border: 2px solid #007bff;
}

button:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(0,0,0,0.15);
}

button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.warning {
    background: #FFF3CD;
    border: 1px solid #FFC107;
    color: #856404;
    padding: 12px 15px;
    border-radius: 6px;
    margin: 15px 0;
    font-weight: 500;
    font-size: 14px;
    display: none;
}

.warning.show {
    display: block;
}
/* ========== СКРЫТИЕ БЛОКА ЦЕН ========== */
.price-section {
    transition: opacity 0.3s ease, max-height 0.3s ease;
    opacity: 1;
    max-height: 500px; /* Достаточно для контента */
    overflow: hidden;
}

.price-section.collapsed {
    opacity: 0;
    max-height: 0;
    margin: 0;
    padding: 0;
    pointer-events: none;
}

/* Кнопка сворачивания */
.collapse-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 14px;
    padding: 0 5px;
    color: #5D4E37;
    width: auto;
    display: inline;
    vertical-align: middle;
    transition: transform 0.3s;
}

.collapse-btn.rotated {
    transform: rotate(-90deg);
}
/* ========== КОНФИГУРАТОР ========== */
header {
    background: linear-gradient(135deg, #5D4E37 0%, #4a3f2f 100%);
    color: white;
    padding: 15px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.logo {
    font-size: 24px;
    font-weight: bold;
}

.logo .version {
    font-size: 12px;
    color: rgba(255,255,255,0.6);
    margin-left: 10px;
}

.user-panel {
    display: flex;
    align-items: center;
    gap: 15px;
}

.user-panel #userName {
    font-weight: 500;
}

.role-badge {
    background: rgba(255,255,255,0.2);
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 12px;
}

.user-panel button {
    width: auto;
    padding: 8px 20px;
    background: rgba(255,255,255,0.2);
    color: white;
    font-size: 14px;
}

.main-container {
    display: grid;
    grid-template-columns: 300px 1fr 320px;
    gap: 20px;
    padding: 20px;
    max-width: 1800px;
    margin: 0 auto;
}

@media (max-width: 1400px) {
    .main-container {
        grid-template-columns: 280px 1fr 300px;
    }
}

@media (max-width: 1200px) {
    .main-container {
        grid-template-columns: 1fr;
    }
}

.panel {
    background: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

.panel h3 {
    color: #5D4E37;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid #f0f0f0;
    font-size: 16px;
}

.panel h4 {
    color: #666;
    margin: 15px 0 10px 0;
    font-size: 14px;
}

/* Левая панель */
.calculated-info {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 6px;
    margin: 20px 0;
}

.info-row {
    display: flex;
    justify-content: space-between;
    padding: 6px 0;
    font-size: 14px;
    border-bottom: 1px solid #e0e0e0;
}

.info-row:last-child {
    border-bottom: none;
}

.radio-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.radio-label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    padding: 10px;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    transition: all 0.3s;
}

.radio-label:hover {
    border-color: #667eea;
    background: #f8f9ff;
}

.radio-label input[type="radio"] {
    width: 18px;
    height: 18px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 10px 0;
    cursor: pointer;
    padding: 8px;
    border-radius: 4px;
}

.checkbox-label:hover {
    background: #f8f9fa;
}

.checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
}

/* Центр - Холст */
.canvas-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.canvas-controls {
    display: flex;
    gap: 10px;
}

.btn-small {
    width: auto;
    padding: 6px 12px;
    font-size: 12px;
    background: #f5f5f5;
    color: #333;
}

#canvasContainer {
    background: #f8f9fa;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    min-height: 500px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.canvas-legend {
    display: flex;
    gap: 20px;
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #e0e0e0;
    flex-wrap: wrap;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: #666;
}

.legend-item .dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
}

/* Правая панель - Цены */
.price-section {
    margin-bottom: 20px;
}

.price-section.retail {
    background: #f8f9ff;
    padding: 15px;
    border-radius: 6px;
    border: 1px solid #e0e0ff;
}

.price-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid #f0f0f0;
    font-size: 14px;
}

.price-row.subtotal {
    border-top: 2px solid #667eea;
    margin-top: 10px;
    padding-top: 10px;
    font-weight: 600;
    color: #667eea;
}

.price-row.total {
    border-top: 2px solid #5D4E37;
    border-bottom: none;
    margin-top: 10px;
    padding-top: 12px;
    font-size: 18px;
    color: #5D4E37;
    font-weight: bold;
}

.info-block {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 6px;
    margin: 20px 0;
}

.spec-row {
    display: flex;
    justify-content: space-between;
    padding: 6px 0;
    font-size: 14px;
}

.action-buttons {
    margin-top: 20px;
}

.status-message {
    margin-top: 15px;
    padding: 12px;
    border-radius: 6px;
    font-size: 14px;
    display: none;
}

.status-message.success {
    display: block;
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.status-message.error {
    display: block;
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* Tooltip для размеров */
.drag-tooltip {
    position: fixed;
    background: rgba(0,0,0,0.85);
    color: white;
    padding: 8px 14px;
    border-radius: 6px;
    font-size: 13px;
    pointer-events: none;
    z-index: 10000;
    white-space: nowrap;
}

/* Анимации */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.panel {
    animation: fadeIn 0.3s ease-out;
}

/* Скроллбар */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #a1a1a1;
}