/* ===== ОБЩИЕ СТИЛИ ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}

body {
    background: #eef2f6;
    min-height: 100vh;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 1px;
}

.app {
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 1920px;
    min-height: 95vh;
    background: #ffffff;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.10);
    overflow: hidden;
}

/* ===== ВЕРХНЯЯ ПАНЕЛЬ ===== */
.top-panel {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 28px;
    background: #ffffff;
    border-bottom: 1px solid #e2e8f0;
    flex-shrink: 0;
    flex-wrap: wrap;
    gap: 10px;
}

.logo h1 {
    font-size: 1.3rem;
    font-weight: 600;
    color: #0f172a;
    letter-spacing: -0.3px;
}
.logo span {
    color: #64748b;
    font-weight: 400;
    font-size: 0.85rem;
}

/* ===== СИМВОЛЫ ===== */
.symbols-bar {
    display: flex;
    align-items: center;
    gap: 6px;
    background: #f8fafc;
    padding: 4px 12px;
    border-radius: 30px;
    border: 1px solid #e2e8f0;
}

.symbols-bar .symbol-label {
    font-size: 0.7rem;
    color: #94a3b8;
    font-weight: 500;
    margin-right: 4px;
    user-select: none;
}

.symbol-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    border-radius: 8px;
    font-size: 1.1rem;
    font-weight: 500;
    color: #1e293b;
    cursor: pointer;
    transition: 0.15s;
    font-family: 'Segoe UI', system-ui, sans-serif;
    user-select: none;
}

.symbol-btn:hover {
    background: #e2e8f0;
    transform: scale(1.1);
}

.symbol-btn:active {
    transform: scale(0.9);
    background: #cbd5e1;
}

.symbol-btn.copied {
    background: #22c55e;
    color: white;
}

.symbol-divider {
    width: 1px;
    height: 24px;
    background: #e2e8f0;
}

/* ===== ВЫПАДАЮЩЕЕ МЕНЮ ===== */
.tool-selector {
    position: relative;
    min-width: 280px;
    flex: 1;
    max-width: 480px;
}

.dropdown-btn {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 10px 20px;
    background: #f8fafc;
    border: 1.5px solid #d0d7de;
    border-radius: 12px;
    font-size: 0.95rem;
    font-weight: 500;
    color: #0f172a;
    cursor: pointer;
    transition: 0.2s;
}

.dropdown-btn:hover {
    background: #f1f5f9;
    border-color: #94a3b8;
}

.dropdown-btn .arrow {
    font-size: 0.7rem;
    margin-left: 10px;
    transition: 0.25s;
}

.dropdown-btn.open .arrow {
    transform: rotate(180deg);
}

.dropdown-menu {
    display: none;
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    background: white;
    border-radius: 16px;
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.18);
    border: 1px solid #e2e8f0;
    padding: 10px 8px;
    z-index: 1000;
    max-height: 420px;
    overflow-y: auto;
}

.dropdown-menu.open {
    display: block;
}

.dropdown-item {
    display: block;
    width: 100%;
    text-align: left;
    padding: 10px 18px;
    border: none;
    background: transparent;
    border-radius: 10px;
    font-size: 0.9rem;
    color: #1e293b;
    cursor: pointer;
    transition: 0.15s;
}

.dropdown-item:hover {
    background: #f1f5f9;
}

.dropdown-item.active {
    background: #e2e8f0;
    font-weight: 600;
}

.dropdown-divider {
    height: 1px;
    background: #e2e8f0;
    margin: 6px 12px;
}

.dropdown-group-title {
    font-weight: 600;
    font-size: 0.75rem;
    color: #94a3b8;
    padding: 6px 18px 4px 18px;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

/* ===== ОСНОВНАЯ ОБЛАСТЬ ===== */
.main-content {
    display: flex;
    flex: 1;
    min-height: 500px;
    max-height:1000px;
}

/* ===== ЛЕВАЯ ЧАСТЬ: ЭСКИЗ ===== */
.sketch-area {
    flex: 3.5;
    background: #f8fafc;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    min-height: 400px;
}

.sketch-container {
    position: relative;
    width: 100%;
    height: 100%;
    min-height: 400px;
    background: white;
    border-radius: 16px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sketch-content {
    position: relative;
    width: 1191px;
    height: 842px;
    transform-origin: center;
    background: white;
    box-shadow: 0 2px 20px rgba(0, 0, 0, 0.08);
    border-radius: 4px;
    flex-shrink: 0;
}

.sketch-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sketch-bg svg {
    width: 100%;
    height: 100%;
}

.sketch-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

/* ============================================
   ===== МЕТКИ С ПЕРЕТАСКИВАНИЕМ =====
   ============================================ */

.sketch-overlay .label {
    position: absolute;
    font-weight: 600;
    color: #0f172a;
    text-shadow: 0 0 12px rgba(255, 255, 255, 0.95), 0 0 6px rgba(255, 255, 255, 0.98);
    white-space: nowrap;
    pointer-events: auto !important;
    font-family: 'Courier New', monospace;
    background: transparent;
    padding: 4px 8px;
    border-radius: 4px;
    user-select: none;
    cursor: default;
    transition: background 0.2s, box-shadow 0.2s;
    z-index: 1;
    transform: translate(-50%, -50%);
    transform-origin: center center;
    text-align: center;
}

.sketch-overlay .label:hover {
    background: rgba(59, 130, 246, 0.08);
    outline: 2px dashed rgba(59, 130, 246, 0.4);
    outline-offset: 2px;
    z-index: 10;
}

.sketch-overlay .label.dragging {
    cursor: grabbing;
    background: rgba(59, 130, 246, 0.15);
    outline: 2px solid rgba(59, 130, 246, 0.6);
    outline-offset: 2px;
    z-index: 100;
    opacity: 0.9;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.15);
}

/* ===== ПОВОРОТ ТЕКСТА ===== */
.sketch-overlay .label.rotate-90 {
    transform: translate(-50%, -50%) rotate(90deg) !important;
}

.sketch-overlay .label.rotate--90 {
    transform: translate(-50%, -50%) rotate(-90deg) !important;
}

.sketch-overlay .label.rotate-180 {
    transform: translate(-50%, -50%) rotate(180deg) !important;
}

/* ===== ВЫРАВНИВАНИЕ ТЕКСТА ===== */
.sketch-overlay .label.align-left {
    transform: translate(0, -50%) !important;
    transform-origin: left center !important;
    text-align: left !important;
}

.sketch-overlay .label.align-right {
    transform: translate(-100%, -50%) !important;
    transform-origin: right center !important;
    text-align: right !important;
}

.sketch-overlay .label.align-center {
    transform: translate(-50%, -50%) !important;
    transform-origin: center center !important;
    text-align: center !important;
}

/* ===== ТУЛТИП ДЛЯ ПЕРЕТАСКИВАНИЯ ===== */
.drag-tooltip {
    position: fixed;
    background: rgba(15, 23, 42, 0.9);
    color: #ffffff;
    padding: 4px 12px;
    border-radius: 6px;
    font-size: 12px;
    font-family: 'Courier New', monospace;
    pointer-events: none;
    z-index: 9999;
    display: none;
    backdrop-filter: blur(4px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

/* ===== ПРАВАЯ ЧАСТЬ: ПАРАМЕТРЫ ===== */
.params-area {
    flex: 1;
    min-width: 280px;
    max-width: 380px;
    background: #f9fafc;
    border-left: 1px solid #e2e8f0;
    display: flex;
    flex-direction: column;
    padding: 22px 24px;
    overflow-y: auto;
    gap: 14px;
}

.params-header {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding-bottom: 14px;
    border-bottom: 1px solid #e2e8f0;
}

.params-title {
    font-weight: 600;
    font-size: 1rem;
    color: #0f172a;
}

.params-toolname {
    font-size: 0.85rem;
    color: #64748b;
}

.input-section {
    display: flex;
    flex-direction: column;
    gap: 14px;
    flex: 1;
    padding: 4px 0;
    overflow-y: auto;
}

.param-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.param-group label {
    font-size: 0.82rem;
    font-weight: 500;
    color: #334155;
    display: flex;
    justify-content: space-between;
}

.param-group label .unit {
    font-weight: 400;
    color: #94a3b8;
}

.param-group input,
.param-group select {
    padding: 10px 14px;
    border: 1.5px solid #d1d9e6;
    border-radius: 10px;
    font-size: 0.9rem;
    background: white;
    transition: 0.15s;
    width: 100%;
    outline: none;
}

.param-group input:focus,
.param-group select:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.12);
}

.param-group input[type="text"] {
    font-family: inherit;
}

/* ===== КНОПКИ ОСНОВНЫЕ ===== */
.btn-group {
    display: flex;
    gap: 10px;
    padding-top: 14px;
    border-top: 1px solid #e2e8f0;
    flex-shrink: 0;
}

.btn {
    flex: 1;
    padding: 11px 18px;
    border: none;
    border-radius: 12px;
    font-weight: 500;
    font-size: 0.85rem;
    cursor: pointer;
    transition: 0.2s;
}

.btn-reset {
    background: #f1f5f9;
    color: #475569;
}

.btn-reset:hover {
    background: #e2e8f0;
}

.btn-save {
    background: #0f172a;
    color: white;
}

.btn-save:hover {
    background: #1e293b;
    transform: scale(1.02);
}

.btn-reset-positions {
    background: #f59e0b;
    color: white;
}

.btn-reset-positions:hover {
    background: #d97706;
    transform: scale(1.02);
}

/* ===== ROW: УПРАВЛЕНИЕ КОДОМ ===== */
.code-row {
    flex-shrink: 0;
    background: #f8fafc;
    padding: 10px 28px;
    border-top: 1px solid #e2e8f0;
}

.code-row-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}

.code-row-title {
    font-size: 0.85rem;
    font-weight: 600;
    color: #0f172a;
    white-space: nowrap;
}

.code-row-buttons {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.code-row-buttons button {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border: none;
    border-radius: 10px;
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: 0.2s;
}

.code-row-buttons button .icon {
    font-size: 1rem;
}

.btn-code-generate {
    background: #8b5cf6;
    color: white;
}

.btn-code-generate:hover {
    background: #7c3aed;
    transform: scale(1.02);
}

.btn-code-import {
    background: #06b6d4;
    color: white;
}

.btn-code-import:hover {
    background: #0891b2;
    transform: scale(1.02);
}

.btn-code-copy {
    background: #22c55e;
    color: white;
}

.btn-code-copy:hover {
    background: #16a34a;
    transform: scale(1.02);
}

.code-row-status {
    font-size: 0.75rem;
    color: #94a3b8;
    padding: 4px 12px;
    background: #f1f5f9;
    border-radius: 20px;
    white-space: nowrap;
}

.code-row-status.success {
    color: #22c55e;
    background: #dcfce7;
}

.code-row-status.error {
    color: #ef4444;
    background: #fee2e2;
}

/* ============================================
   ===== ROW: МАССОВАЯ ГЕНЕРАЦИЯ =====
   ============================================ */

.batch-row {
    flex-shrink: 0;
    background: #f8fafc;
    overflow: hidden;
    transition: all 0.3s ease;
    border-top: 1px solid #e2e8f0;
}

.batch-row.collapsed .batch-row-body {
    display: none;
}

.batch-row.collapsed .batch-toggle-icon {
    transform: rotate(-90deg);
}

.batch-row-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 20px;
    cursor: pointer;
    user-select: none;
    transition: background 0.2s;
    flex-shrink: 0;
}

.batch-row-header:hover {
    background: #f1f5f9;
}

.batch-row-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    font-weight: 600;
    color: #0f172a;
}

.batch-toggle-icon {
    display: inline-block;
    transition: transform 0.3s ease;
    font-size: 12px;
}

.batch-row-badge {
    font-size: 11px;
    font-weight: 400;
    color: #64748b;
    background: #e2e8f0;
    padding: 1px 10px;
    border-radius: 12px;
}

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

.btn-batch-close {
    background: none;
    border: none;
    font-size: 18px;
    cursor: pointer;
    color: #94a3b8;
    padding: 2px 8px;
    border-radius: 6px;
    transition: 0.2s;
}

.btn-batch-close:hover {
    background: #e2e8f0;
    color: #0f172a;
}

.batch-row-body {
    padding: 12px 20px 16px 20px;
}

.batch-row-section {
    margin-bottom: 8px;
}

.batch-row-fields {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: flex-end;
}

.batch-field {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.batch-field label {
    font-size: 11px;
    font-weight: 500;
    color: #64748b;
}

.batch-field select,
.batch-field input {
    padding: 6px 10px;
    border: 1.5px solid #d1d9e6;
    border-radius: 8px;
    font-size: 13px;
    background: white;
    outline: none;
}

.batch-field select:focus,
.batch-field input:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.12);
}

.batch-dropzone {
    padding: 6px 14px;
    border: 1.5px dashed #d1d9e6;
    border-radius: 8px;
    font-size: 12px;
    color: #64748b;
    cursor: pointer;
    transition: 0.2s;
    background: #fafbfc;
    white-space: nowrap;
}

.batch-dropzone:hover {
    border-color: #8b5cf6;
    background: rgba(139, 92, 246, 0.04);
}

.batch-dropzone.dragover {
    border-color: #8b5cf6;
    background: rgba(139, 92, 246, 0.08);
}

.btn-batch-download {
    padding: 6px 14px;
    background: #3b82f6;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: 0.2s;
    white-space: nowrap;
}

.btn-batch-download:hover {
    background: #2563eb;
}

.btn-batch-generate {
    padding: 6px 16px;
    background: #22c55e;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: 0.2s;
    white-space: nowrap;
}

.btn-batch-generate:hover {
    background: #16a34a;
}

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

/* Таблица */
.batch-table-section {
    margin-top: 6px;
    border-top: 1px solid #e2e8f0;
    padding-top: 8px;
}

.batch-table-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
    flex-wrap: wrap;
    gap: 4px;
}

.batch-table-title {
    font-size: 12px;
    font-weight: 600;
    color: #0f172a;
}

.batch-table-actions {
    display: flex;
    gap: 4px;
}

.btn-batch-add {
    padding: 2px 8px;
    background: #3b82f6;
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 10px;
    cursor: pointer;
    transition: 0.2s;
}

.btn-batch-add:hover {
    background: #2563eb;
}

.btn-batch-remove {
    padding: 2px 8px;
    background: #ef4444;
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 10px;
    cursor: pointer;
    transition: 0.2s;
}

.btn-batch-remove:hover {
    background: #dc2626;
}

.btn-batch-refresh {
    padding: 2px 8px;
    background: #8b5cf6;
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 10px;
    cursor: pointer;
    transition: 0.2s;
}

.btn-batch-refresh:hover {
    background: #7c3aed;
}

.batch-table-wrapper {
    max-height: 200px;
    overflow: auto;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
}

.batch-table-wrapper table {
    width: 100%;
    border-collapse: collapse;
    font-size: 11px;
}

.batch-table-wrapper thead {
    position: sticky;
    top: 0;
    background: #f8fafc;
    z-index: 1;
}

.batch-table-wrapper th {
    padding: 4px 6px;
    border-bottom: 1px solid #e2e8f0;
    text-align: left;
    font-size: 10px;
    font-weight: 600;
    color: #475569;
    white-space: nowrap;
}

.batch-table-wrapper td {
    padding: 2px 4px;
    border-bottom: 1px solid #f1f5f9;
}

.batch-table-wrapper tr:hover td {
    background: #f8fafc;
}

.batch-table-wrapper input[type="text"] {
    width: 100%;
    padding: 3px 4px;
    font-size: 10px;
    font-family: 'Courier New', monospace;
    border: 1px solid transparent;
    border-radius: 3px;
    background: transparent;
    transition: 0.2s;
    min-width: 40px;
}

.batch-table-wrapper input[type="text"]:focus {
    border-color: #3b82f6;
    background: white;
    outline: none;
}

.batch-table-wrapper input[type="checkbox"] {
    cursor: pointer;
}

.batch-table-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 4px;
    font-size: 11px;
    color: #64748b;
    flex-wrap: wrap;
    gap: 4px;
}

.batch-table-pagination {
    display: flex;
    align-items: center;
    gap: 6px;
}

.btn-batch-page {
    padding: 2px 8px;
    border: 1px solid #d1d9e6;
    border-radius: 4px;
    background: white;
    cursor: pointer;
    font-size: 11px;
    transition: 0.2s;
}

.btn-batch-page:hover:not(:disabled) {
    background: #f1f5f9;
}

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

/* Результаты */
.batch-results-section {
    margin-top: 6px;
    border-top: 1px solid #e2e8f0;
    padding-top: 6px;
}

.batch-results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
    flex-wrap: wrap;
    gap: 4px;
}

.batch-results-title {
    font-size: 12px;
    font-weight: 600;
    color: #0f172a;
}

.btn-batch-download-all {
    padding: 3px 12px;
    background: #0f172a;
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 11px;
    cursor: pointer;
    transition: 0.2s;
}

.btn-batch-download-all:hover {
    background: #1e293b;
}

.batch-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    gap: 6px;
    max-height: 200px;
    overflow-y: auto;
    padding: 2px 0;
}

.batch-gallery .batch-item {
    position: relative;
    background: #f8fafc;
    border-radius: 4px;
    overflow: hidden;
    border: 1px solid #e2e8f0;
    aspect-ratio: 1 / 1;
    cursor: pointer;
    transition: 0.2s;
}

.batch-gallery .batch-item:hover {
    transform: scale(1.03);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    border-color: #8b5cf6;
}

.batch-gallery .batch-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.batch-gallery .batch-item .batch-item-label {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(0, 0, 0, 0.6);
    color: white;
    font-size: 9px;
    padding: 2px 4px;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.batch-gallery .batch-item .batch-item-preview {
    position: absolute;
    top: 2px;
    right: 2px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 2px 4px;
    border-radius: 3px;
    font-size: 10px;
    cursor: pointer;
    transition: 0.2s;
    z-index: 2;
}

.batch-gallery .batch-item .batch-item-preview:hover {
    transform: scale(1.1);
}

/* ===== МОДАЛЬНЫЕ ОКНА ===== */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 2000;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(4px);
}

.modal-overlay.active {
    display: flex;
}

.modal {
    background: white;
    border-radius: 20px;
    padding: 30px;
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.25);
    position: relative;
}

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

.modal-header h2 {
    font-size: 1.2rem;
    color: #0f172a;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #94a3b8;
    padding: 4px 8px;
    border-radius: 8px;
    transition: 0.15s;
}

.modal-close:hover {
    background: #f1f5f9;
    color: #0f172a;
}

.modal textarea {
    width: 100%;
    min-height: 120px;
    padding: 14px;
    border: 1.5px solid #d1d9e6;
    border-radius: 12px;
    font-size: 0.85rem;
    font-family: 'Courier New', monospace;
    resize: vertical;
    background: #f8fafc;
    outline: none;
}

.modal textarea:focus {
    border-color: #8b5cf6;
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.12);
}

.modal .modal-actions {
    display: flex;
    gap: 10px;
    margin-top: 16px;
    flex-wrap: wrap;
}

.modal .modal-actions .btn {
    flex: 1;
    min-width: 100px;
}

.btn-copy-code {
    background: #8b5cf6;
    color: white;
}

.btn-copy-code:hover {
    background: #7c3aed;
}

.btn-import-code {
    background: #06b6d4;
    color: white;
}

.btn-import-code:hover {
    background: #0891b2;
}

.btn-close-modal {
    background: #f1f5f9;
    color: #475569;
}

.btn-close-modal:hover {
    background: #e2e8f0;
}

.code-info {
    font-size: 0.8rem;
    color: #64748b;
    margin-bottom: 12px;
    padding: 8px 12px;
    background: #f1f5f9;
    border-radius: 8px;
}

/* ===== SCROLLBAR ===== */
.dropdown-menu::-webkit-scrollbar,
.params-area::-webkit-scrollbar,
.modal::-webkit-scrollbar,
.batch-table-wrapper::-webkit-scrollbar,
.batch-gallery::-webkit-scrollbar {
    width: 2px;
}

.dropdown-menu::-webkit-scrollbar-track,
.params-area::-webkit-scrollbar-track,
.modal::-webkit-scrollbar-track,
.batch-table-wrapper::-webkit-scrollbar-track,
.batch-gallery::-webkit-scrollbar-track {
    background: transparent;
}

.dropdown-menu::-webkit-scrollbar-thumb,
.params-area::-webkit-scrollbar-thumb,
.modal::-webkit-scrollbar-thumb,
.batch-table-wrapper::-webkit-scrollbar-thumb,
.batch-gallery::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 1024px) {
    .app {
        min-height: 98vh;
        border-radius: 16px;
    }
    .main-content {
        flex-direction: column;
        min-height: 400px;
    }
    .params-area {
        max-width: 100%;
        border-left: none;
        border-top: 1px solid #e2e8f0;
        min-height: 200px;
        max-height: 280px;
        padding: 16px 20px;
    }
    .sketch-area {
        min-height: 300px;
        padding: 12px;
    }
    .sketch-container {
        min-height: 300px;
    }
    .tool-selector {
        max-width: 100%;
        min-width: 200px;
    }
    .sketch-content {
        width: 100%;
        height: auto;
        aspect-ratio: 1191 / 842;
    }
    .symbols-bar {
        padding: 4px 10px;
    }
    .symbol-btn {
        width: 28px;
        height: 28px;
        font-size: 0.95rem;
    }
    .code-row-inner {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }
    .code-row-buttons {
        justify-content: center;
    }
    .batch-row-fields {
        flex-direction: column;
        align-items: stretch;
    }
    .batch-field {
        width: 100%;
    }
    .batch-table-wrapper {
        max-height: 150px;
    }
    .batch-gallery {
        max-height: 150px;
        grid-template-columns: repeat(auto-fill, minmax(70px, 1fr));
    }
}

@media (max-width: 600px) {
    body {
        padding: 6px;
    }
    .app {
        min-height: 99vh;
        border-radius: 12px;
    }
    .top-panel {
        flex-direction: column;
        align-items: stretch;
        padding: 12px 16px;
    }
    .logo h1 {
        font-size: 1.1rem;
    }
    .tool-selector {
        min-width: unset;
    }
    .dropdown-menu {
        max-height: 280px;
    }
    .params-area {
        padding: 12px 14px;
        max-height: 220px;
        min-height: 150px;
    }
    .btn-group {
        flex-direction: row;
        flex-wrap: wrap;
    }
    .btn {
        min-width: 60px;
        font-size: 0.7rem;
        padding: 8px 10px;
    }
    .symbols-bar {
        justify-content: center;
        flex-wrap: wrap;
    }
    .symbol-btn {
        width: 30px;
        height: 30px;
        font-size: 1rem;
    }
    .modal {
        padding: 20px;
        width: 95%;
    }
    .code-row {
        padding: 8px 12px;
    }
    .code-row-buttons button {
        font-size: 0.7rem;
        padding: 6px 10px;
    }
    .code-row-title {
        font-size: 0.75rem;
        text-align: center;
        white-space: normal;
    }
    .code-row-status {
        font-size: 0.7rem;
        text-align: center;
    }
    .batch-row-header {
        padding: 6px 12px;
    }
    .batch-row-title {
        font-size: 11px;
    }
    .batch-row-body {
        padding: 6px 12px 10px 12px;
    }
    .batch-table-toolbar {
        flex-direction: column;
        align-items: stretch;
    }
    .batch-table-actions {
        flex-wrap: wrap;
    }
    .batch-table-footer {
        flex-direction: column;
        align-items: stretch;
        text-align: center;
    }
    .batch-results-header {
        flex-direction: column;
        align-items: stretch;
    }
    .batch-gallery {
        grid-template-columns: repeat(auto-fill, minmax(60px, 1fr));
        max-height: 120px;
    }
    .batch-table-wrapper {
        max-height: 100px;
    }
}
/* ===== БЛОКИ НИЖЕ ===== */
.bottom-blocks {
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    border-top: 1px solid #e2e8f0;
    background: #f8fafc;
    overflow: hidden;
    max-height: 600px;
}

/* ===== ROW: УПРАВЛЕНИЕ КОДОМ ===== */
.code-row {
    flex-shrink: 0;
    background: #f8fafc;
    padding: 10px 28px;
    border-bottom: 1px solid #e2e8f0;
}

/* ===== ROW: МАССОВАЯ ГЕНЕРАЦИЯ ===== */
.batch-row {
    flex-shrink: 0;
    background: #f8fafc;
    overflow: hidden;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    min-height: 46px;
}

.batch-row.collapsed {
    min-height: 46px;
    max-height: 46px;
}

.batch-row.collapsed .batch-row-body {
    display: none;
}

.batch-row.collapsed .batch-toggle-icon {
    transform: rotate(-90deg);
}

.batch-row-body {
    padding: 12px 20px 16px 20px;
    overflow-y: auto;
    flex: 1;
    min-height: 300px;
}

/* Таблица */
.batch-table-wrapper {
    min-height: 500px;
    max-height: 700px;
    overflow: auto;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
}

/* ===== ЛЕВАЯ ЧАСТЬ: ЭСКИЗ ===== */
.sketch-container {
    position: relative;
    width: 100%;
    height: 100%;
    max-height: 950px;
    background: white;
    border-radius: 16px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}