/* * { box-sizing: border-box; margin: 0; padding: 0; } */

/*
html, body {
    height: 100%;
    overflow: hidden;
    font-family: system-ui, -apple-system, sans-serif;
    background: #e8ecf0;
    color: #222;
    font-size: 13px;
}
*/

.app { display: flex; flex-direction: column; height: calc (100vh-90px); overflow: hidden; }

/* ==================== ВЕРХНЯЯ ПАНЕЛЬ ==================== */
.top-bar {
    display: flex; align-items: center; gap: 8px;
    padding: 6px 12px; background: #fff;
    border-bottom: 1px solid #d0d5da;
    flex-shrink: 0; flex-wrap: wrap;
    position: relative; z-index: 100;
}
.app-title { font-weight: 300; letter-spacing: 0px; color: #888; font-size: 13px; margin-right: 8px; }

.mode-tabs { display: flex; gap: 2px; background: #e8ecf0; padding: 3px; border-radius: 7px; }
.mode-tabs button {
    background: transparent; border: none; color: #666;
    padding: 5px 11px; border-radius: 5px; cursor: pointer;
    font-size: 12px; font-weight: 500; white-space: nowrap;
}
.mode-tabs button.active { background: #3b82f6; color: #fff; }
.mode-tabs button:hover:not(.active) { color: #222; }

.spacer { flex: 1; }

/* ==================== ОСНОВНАЯ ОБЛАСТЬ ==================== */
.main-area { display: flex; flex: 1; overflow: hidden; min-height: 0; }

.tool-panel {
    width: 48px; background: #fff;
    border-right: 1px solid #d0d5da;
    display: flex; flex-direction: column;
    padding: 6px 4px; gap: 4px;
    flex-shrink: 0; overflow: visible;
    align-items: center;
    position: relative;
    z-index: 10;
}

.tool-btn {
    width: 38px; height: 38px;
    border-radius: 6px; border: 1px solid transparent;
    background: transparent; color: #555;
    cursor: pointer; font-size: 16px;
    display: flex; align-items: center; justify-content: center;
    transition: all 0.15s; position: relative;
    flex-shrink: 0;
}
.tool-btn:hover { background: #eef2f6; color: #000; }
.tool-btn.active { background: #3b82f6; color: #fff; }

.tool-sep { height: 1px; background: #d0d5da; width: 100%; margin: 4px 0; flex-shrink: 0; }

.tool-group { position: relative; }

.tool-expand {
    position: absolute; right: -3px; bottom: -3px;
    width: 14px; height: 14px; padding: 0;
    font-size: 8px; background: #fff;
    border: 1px solid #d0d5da; border-radius: 3px;
    color: #888; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    z-index: 5;
}
.tool-expand:hover { background: #3b82f6; color: #fff; border-color: #3b82f6; }

.tool-menu {
    display: none;
    position: fixed;
    background: #fff;
    border: 1px solid #d0d5da;
    border-radius: 6px;
    padding: 4px;
    z-index: 9999;
    min-width: 180px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.25);
}
.tool-menu.open { display: block; }
.tool-menu button {
    display: block; width: 100%; text-align: left;
    background: transparent; border: none;
    color: #333; padding: 8px 12px;
    border-radius: 4px; cursor: pointer;
    font-size: 12px; white-space: nowrap;
}
.tool-menu button:hover { background: #eef2f6; }
.tool-menu button.active { background: #3b82f6; color: #fff; }

.color-square {
    width: 36px; height: 36px;
    border-radius: 6px; border: 2px solid #d0d5da;
    cursor: pointer; position: relative;
    overflow: hidden; flex-shrink: 0;
}
.color-square:hover { border-color: #3b82f6; }

/* ==================== CANVAS ==================== */
.canvas-area {
    flex: 1; position: relative; overflow: hidden;
    background-color: #d8dde2;
    background-image:
        linear-gradient(45deg, #c8cdd2 25%, transparent 25%),
        linear-gradient(-45deg, #c8cdd2 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, #c8cdd2 75%),
        linear-gradient(-45deg, transparent 75%, #c8cdd2 75%);
    background-size: 20px 20px;
    background-position: 0 0, 0 10px, 10px -10px, -10px 0px;
    cursor: default; user-select: none; touch-action: none;
}

.canvas-area.tool-zoom { cursor: zoom-in; }
.canvas-area.tool-zoom.alt { cursor: zoom-out; }
.canvas-area.tool-select-rect { cursor: crosshair; }
.canvas-area.tool-select-ellipse { cursor: crosshair; }
.canvas-area.tool-select-lasso { cursor: crosshair; }
.canvas-area.tool-select-poly { cursor: crosshair; }
.canvas-area.tool-move { cursor: grab; }
.canvas-area.tool-move.dragging { cursor: grabbing; }
.canvas-area.tool-text { cursor: text; }

.canvas-area.tool-picker {
    cursor: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M3 21 L3 17 L14 6 L18 10 L7 21 Z M15 5 L17 3 L21 7 L19 9 Z" fill="%233b82f6" stroke="%23fff" stroke-width="1"/></svg>') 3 21, crosshair;
}

.canvas-area.tool-fill {
    cursor: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M5 9 L12 2 L19 9 L12 16 Z" fill="%233b82f6" stroke="%23fff" stroke-width="1"/><path d="M17 14 Q19 18 17 20 Q15 22 13 20 Q11 18 13 14 Z" fill="%233b82f6" stroke="%23fff" stroke-width="1"/></svg>') 12 12, crosshair;
}

.canvas-area.tool-brush,
.canvas-area.tool-eraser { cursor: none; }

.canvas-stage {
    position: absolute; top: 0; left: 0;
    transform-origin: 0 0; will-change: transform;
    line-height: 0;
}
/*
.canvas-stage canvas {
    display: block; image-rendering: pixelated;
    box-shadow: 0 0 0 1px rgba(0,0,0,0.1), 0 4px 30px rgba(0,0,0,0.15);
}
*/

.canvas-stage canvas {
    display: block;
    box-shadow: 0 0 0 1px rgba(0,0,0,0.1), 0 4px 30px rgba(0,0,0,0.15);
}

/*
.canvas-stage canvas {
    display: block;
    box-shadow: 0 0 0 1px rgba(0,0,0,0.1), 0 4px 30px rgba(0,0,0,0.15);
}
*/

/* Шторка: результат поверх оригинала ВНУТРИ stage */
.compare-layer {
    position: absolute;
    top: 0; left: 0;
    pointer-events: none;
    z-index: 3;
    clip-path: inset(0 0 0 50%);
}
.compare-layer.hidden { display: none; }

/* Шторка: ползунок позиционируется В canvas-area, не в stage */
.compare-slider {
    position: absolute;
    top: 0;
    width: 3px;
    background: #fff;
    cursor: ew-resize;
    z-index: 10;
    box-shadow: 0 0 6px rgba(0,0,0,0.5);
}
.compare-slider.hidden { display: none; }
.compare-slider::after {
    content: '◄ ►';
    position: absolute; top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    width: 40px; height: 20px; line-height: 20px;
    text-align: center;
    background: #fff; color: #000;
    border-radius: 10px; font-size: 10px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.4);
}

.selection-svg {
    position: absolute;
    top: 0; left: 0;
    pointer-events: none;
    z-index: 4;
    overflow: visible;
}

.zoom-rect {
    position: absolute;
    border: 1px dashed #3b82f6;
    background: rgba(59,130,246,0.1);
    pointer-events: none; z-index: 20;
}

/* Живой кружок для кисти/ластика */
.brush-cursor {
    position: absolute;
    border-radius: 50%;
    pointer-events: none;
    z-index: 50;
    box-shadow: 0 0 0 1px rgba(0,0,0,0.8), inset 0 0 0 1px rgba(255,255,255,0.9);
    transform: translate(-50%, -50%);
}
.brush-cursor.hidden { display: none; }
.brush-cursor.eraser {
    border: 1px dashed #fff;
    background: rgba(255,255,255,0.15);
}

/* ==================== ПРАВАЯ ПАНЕЛЬ ==================== */
.right-panel {
    width: 300px; background: #fff;
    border-left: 1px solid #d0d5da;
    display: flex; flex-direction: column;
    flex-shrink: 0; overflow: hidden;
    position: relative;
    z-index: 5;
}

.panel-header {
    padding: 8px 12px; background: #f4f6f8;
    font-size: 11px; color: #555;
    text-transform: uppercase; letter-spacing: 1px;
    font-weight: 600;
    display: flex; justify-content: space-between;
    align-items: center; flex-shrink: 0;
}

.panel-content { flex: 1; overflow-y: auto; padding: 10px 12px; }

.tab-panel { display: none; }
.tab-panel.active { display: block; }

.panel-section {
    margin-bottom: 14px; padding-bottom: 12px;
    border-bottom: 1px solid #e2e6ea;
}
.panel-section:last-child { border-bottom: none; padding-bottom: 0; margin-bottom: 0; }

.panel-section h4 {
    font-size: 11px; color: #555;
    text-transform: uppercase; letter-spacing: 1px;
    margin-bottom: 8px; font-weight: 600;
}

.control { margin-bottom: 8px; }
.control:last-child { margin-bottom: 0; }
.control label { display: block; font-size: 11px; color: #555; margin-bottom: 4px; }

.row { display: flex; gap: 6px; align-items: center; }

input[type=number], input[type=text], select, textarea {
    background: #f8fafc;
    border: 1px solid #d0d5da;
    color: #222; padding: 6px 8px;
    border-radius: 5px; font-size: 12px;
    width: 100%; outline: none; font-family: inherit;
}
input[type=number]:focus, input[type=text]:focus, select:focus, textarea:focus {
    border-color: #3b82f6;
}

input[type=range] {
    width: 100%; cursor: pointer;
    accent-color: #3b82f6; height: 4px;
}
input[type=range]:disabled { opacity: 0.4; cursor: not-allowed; }
input[type=checkbox] { accent-color: #3b82f6; cursor: pointer; width: auto; }
input[type=color] {
    width: 40px; height: 28px;
    border: 1px solid #d0d5da; border-radius: 5px;
    cursor: pointer; background: transparent; padding: 2px;
}

.slider-row { display: flex; align-items: center; gap: 8px; }
.slider-value {
    min-width: 42px; text-align: right;
    font-family: monospace; font-size: 12px; color: #3b82f6;
}

.btn {
    padding: 6px 10px; border-radius: 6px; border: none;
    font-size: 12px; font-weight: 500; cursor: pointer;
    transition: all 0.15s; background: #e8ecf0; color: #222;
    white-space: nowrap;
}
.btn:hover { background: #d8dde2; }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }
.btn.primary { background: #3b82f6; color: #fff; }
.btn.primary:hover:not(:disabled) { background: #2563eb; }
.btn.danger { background: #fee; color: #c00; }
.btn.danger:hover { background: #fdd; }
.btn.sm { padding: 4px 8px; font-size: 11px; }
.btn.wide { width: 100%; }

.btn-group { display: flex; gap: 4px; flex-wrap: wrap; }
.btn-group.grid-2 { display: grid; grid-template-columns: 1fr 1fr; }
.btn-group.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; }

.layers-list {
    display: flex; flex-direction: column;
    gap: 4px; max-height: 200px; overflow-y: auto;
}
.layer-item {
    display: flex; align-items: center; gap: 6px;
    padding: 6px 8px; background: #f4f6f8;
    border-radius: 5px; cursor: pointer; font-size: 12px;
    border: 1px solid transparent;
}
.layer-item:hover { background: #e8ecf0; }
.layer-item.active { background: #3b82f6; color: #fff; }
.layer-item .layer-name {
    flex: 1; overflow: hidden;
    text-overflow: ellipsis; white-space: nowrap;
}
.layer-item .layer-vis { cursor: pointer; font-size: 12px; color: #888; }
.layer-item.active .layer-vis { color: #fff; }

.info-block {
    font-size: 11px; line-height: 1.8;
    color: #555; font-family: monospace;
}
.info-block > div { display: flex; justify-content: space-between; }
.info-block .k { color: #888; }
.info-block .v { color: #222; }
.info-block .green { color: #16a34a; }
.info-block .red { color: #dc2626; }
.info-block .section {
    color: #3b82f6; font-weight: bold;
    margin-top: 8px; border-top: 1px solid #e2e6ea;
    padding-top: 8px;
}

.status-bar {
    display: flex; gap: 16px;
    padding: 4px 12px; background: #f4f6f8;
    font-family: monospace; font-size: 11px; color: #666;
    flex-shrink: 0; flex-wrap: wrap;
    align-items: center;
    border-top: 1px solid #d0d5da;
    position: relative; z-index: 100;
}
.status-bar .k { color: #999; }
.status-bar .v { color: #222; }

/*
.upload-zone {
    position: fixed; inset: 0; background: #fff;
    display: flex; align-items: center; justify-content: center;
    flex-direction: column; gap: 16px;
    cursor: pointer; z-index: 10000;
}
*/
/*
.upload-zone {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 16px;
    min-height: 300px;
    background: #fff;
    cursor: pointer;
    z-index: 1;
}
*/
.upload-zone {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: #fff;
    display: flex; align-items: center; justify-content: center;
    flex-direction: column; gap: 16px;
    cursor: pointer; z-index: 100;
}
.upload-zone.dragover { background: #eef2f6; }
.upload-zone input { display: none; }
.upload-zone .icon { font-size: 64px; opacity: 0.5; }
.upload-zone .hint { color: #555; font-size: 14px; }
.upload-zone .sub { color: #888; font-size: 11px; }

.compare-table {
    font-size: 11px; font-family: monospace;
    width: 100%; border-collapse: collapse;
}
.compare-table th {
    text-align: left; color: #666;
    font-weight: normal; padding: 4px 0;
    border-bottom: 1px solid #e2e6ea;
}
.compare-table td { padding: 4px 0; }
.compare-table .best { color: #16a34a; }
.compare-table .dim { color: #999; }

.metadata-box {
    max-height: 350px; overflow-y: auto;
    font-size: 11px; font-family: monospace;
}
.metadata-row {
    display: flex; gap: 4px; padding: 3px 0;
    border-bottom: 1px solid #e2e6ea;
    align-items: center;
}
.metadata-row .key {
    color: #666; width: 45%;
    word-break: break-all; font-size: 11px;
}
.metadata-row .val {
    flex: 1; color: #222;
    word-break: break-all; font-size: 11px;
    background: transparent; border: none;
    padding: 2px 4px; cursor: pointer;
    border-radius: 3px;
}
.metadata-row .val:hover { background: #eef2f6; }
.metadata-row .val:focus { background: #eef2f6; outline: 1px solid #3b82f6; }
.metadata-empty { color: #888; padding: 10px; text-align: center; font-size: 12px; }

.color-palette {
    display: grid; grid-template-columns: repeat(10, 1fr);
    gap: 3px; margin-top: 6px;
}
.color-swatch {
    aspect-ratio: 1; border-radius: 3px;
    cursor: pointer; border: 1px solid #d0d5da;
}
.color-swatch:hover { transform: scale(1.1); }
.color-swatch.active { border: 2px solid #3b82f6; }

.panel-toggle {
    display: none; background: #3b82f6; border: none;
    color: #fff; border-radius: 5px;
    padding: 6px 10px; cursor: pointer; font-size: 14px;
}

.hidden { display: none !important; }

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: #e8ecf0; }
::-webkit-scrollbar-thumb { background: #c8cdd2; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #b0b5ba; }

.theme-toggle {
    background: transparent;
    border: 1px solid #d0d5da; color: #333;
    padding: 6px 10px; border-radius: 6px;
    cursor: pointer; font-size: 14px; line-height: 1;
}
.theme-toggle:hover { background: #eef2f6; }

/* ==================== ТЁМНАЯ ТЕМА ==================== */
body.dark .app { background: #1a1a2e; color: #eee; }
body.dark .top-bar { background: #16213e; border-bottom-color: #0f3460; }
body.dark .app-title { color: #aaa; }
body.dark .theme-toggle { border-color: #2a2a4a; color: #eee; }
body.dark .theme-toggle:hover { background: rgba(255,255,255,0.1); }
body.dark .mode-tabs { background: #0f3460; }
body.dark .mode-tabs button { color: #888; }
body.dark .mode-tabs button.active { background: #6c63ff; color: #fff; }
body.dark .mode-tabs button:hover:not(.active) { color: #ccc; }
body.dark .btn { background: #2a2a4a; color: #eee; }
body.dark .btn:hover { background: #3a3a5a; }
body.dark .btn.primary { background: #6c63ff; color: #fff; }
body.dark .btn.primary:hover:not(:disabled) { background: #5a52e0; }
body.dark .btn.danger { background: #4a1a1a; color: #f88; }
body.dark .tool-panel { background: #16213e; border-right-color: #0f3460; }
body.dark .tool-btn { color: #aaa; }
body.dark .tool-btn:hover { background: #0f3460; color: #eee; }
body.dark .tool-btn.active { background: #6c63ff; color: #fff; }
body.dark .tool-sep { background: #0f3460; }
body.dark .tool-menu { background: #16213e; border-color: #0f3460; box-shadow: 0 4px 20px rgba(0,0,0,0.5); }
body.dark .tool-menu button { color: #ccc; }
body.dark .tool-menu button:hover { background: #0f3460; color: #fff; }
body.dark .tool-menu button.active { background: #6c63ff; color: #fff; }
body.dark .tool-expand { background: #16213e; border-color: #0f3460; color: #888; }
body.dark .tool-expand:hover { background: #6c63ff; color: #fff; }
body.dark .color-square { border-color: #0f3460; }
body.dark .canvas-area {
    background-color: #0a0a18;
    background-image:
        linear-gradient(45deg, #1f1f3a 25%, transparent 25%),
        linear-gradient(-45deg, #1f1f3a 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, #1f1f3a 75%),
        linear-gradient(-45deg, transparent 75%, #1f1f3a 75%);
}
body.dark .canvas-stage canvas {
    box-shadow: 0 0 0 1px rgba(255,255,255,0.05), 0 4px 30px rgba(0,0,0,0.6);
}
body.dark .right-panel { background: #16213e; border-left-color: #0f3460; }
body.dark .panel-header { background: #0f3460; color: #aaa; }
body.dark .panel-content { color: #eee; }
body.dark .panel-section { border-bottom-color: #0f3460; }
body.dark .panel-section h4 { color: #888; }
body.dark .control label { color: #999; }
body.dark input[type=number], body.dark input[type=text], body.dark select, body.dark textarea {
    background: #0f3460; border-color: #1a1a4e; color: #eee;
}
body.dark .slider-value { color: #6c63ff; }
body.dark .info-block { color: #aaa; }
body.dark .info-block .k { color: #888; }
body.dark .info-block .v { color: #eee; }
body.dark .info-block .section { color: #6c63ff; border-top-color: #2a2a4a; }
body.dark .status-bar { background: #0f3460; color: #888; border-top-color: #1a1a4e; }
body.dark .status-bar .k { color: #666; }
body.dark .status-bar .v { color: #ccc; }
body.dark .layer-item { background: #0f3460; color: #eee; }
body.dark .layer-item:hover { background: #1a4a80; }
body.dark .layer-item.active { background: #6c63ff; color: #fff; }
body.dark .metadata-row { border-bottom-color: #1a1a4e; }
body.dark .metadata-row .key { color: #888; }
body.dark .metadata-row .val { color: #ddd; }
body.dark .metadata-row .val:hover { background: #0f3460; }
body.dark .metadata-row .val:focus { background: #0f3460; outline-color: #6c63ff; }
body.dark .compare-table th { color: #888; border-bottom-color: #2a2a4a; }
body.dark .compare-table .dim { color: #666; }
body.dark .upload-zone { background: #1a1a2e; color: #eee; }
body.dark .upload-zone.dragover { background: #1a1a4e; }
body.dark .upload-zone .hint { color: #888; }
body.dark .upload-zone .sub { color: #666; }
body.dark .color-swatch { border-color: #0f3460; }
body.dark ::-webkit-scrollbar-track { background: #0f3460; }
body.dark ::-webkit-scrollbar-thumb { background: #2a2a4a; }

/* ==================== МОБИЛЬНАЯ ==================== */
@media (max-width: 900px) {
    .right-panel {
        position: absolute; right: 0; top: 0; bottom: 0;
        width: 280px; transform: translateX(100%);
        transition: transform 0.25s; z-index: 50;
        box-shadow: -4px 0 20px rgba(0,0,0,0.4);
    }
    .right-panel.open { transform: translateX(0); }
    .tool-panel { width: 44px; padding: 4px 2px; }
    .tool-btn { width: 36px; height: 36px; font-size: 15px; }
    .top-bar { padding: 4px 8px; gap: 4px; }
    .app-title { display: none; }
    .panel-toggle { display: flex !important; }
}
.render-status {
    text-align: center;
    font-size: 12px;
    color: #3b82f6;
    min-height: 18px;
    padding: 4px 0;
    font-weight: 500;
}
.render-status.show::before {
    content: '⟳ Обработка...';
    display: inline-block;
    animation: render-pulse 1s ease-in-out infinite;
}
@keyframes render-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

.slider-value[contenteditable="true"] {
    cursor: text;
    padding: 1px 4px;
    border-radius: 3px;
    min-width: 40px;
    text-align: right;
}
.slider-value[contenteditable="true"]:hover {
    background: #eef2f6;
}
.slider-value[contenteditable="true"]:focus {
    background: #eef2f6;
    outline: 1px solid #3b82f6;
}
body.dark .slider-value[contenteditable="true"]:hover,
body.dark .slider-value[contenteditable="true"]:focus {
    background: #0f3460;
}
/* ==================== МЕТАДАННЫЕ (новая панель) ==================== */
.meta-group-title {
    font-size: 10px;
    color: #3b82f6;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 600;
    margin: 8px 0 4px;
    padding-bottom: 2px;
    border-bottom: 1px solid #e2e6ea;
}
.meta-group-title:first-child { margin-top: 0; }
.metadata-row { display: flex; gap: 4px; align-items: center; }
.metadata-row .key {
    width: 40%;
    word-break: break-all;
    font-size: 10px;
}
.metadata-row input.val {
    flex: 1;
    padding: 3px 6px;
    font-size: 11px;
    background: #f8fafc;
    border: 1px solid #d0d5da;
    border-radius: 4px;
    color: #222;
}
.metadata-row input.val:focus { border-color: #3b82f6; outline: none; }
.metadata-row input.val[readonly] {
    background: #f0f0f0;
    color: #888;
    cursor: not-allowed;
}
.meta-del {
    background: transparent;
    border: none;
    color: #c00;
    font-size: 12px;
    cursor: pointer;
    padding: 2px 4px;
    border-radius: 3px;
    flex-shrink: 0;
}
.meta-del:hover { background: #fee; }
body.dark .meta-group-title { color: #6c63ff; border-bottom-color: #1a1a4e; }
body.dark .metadata-row input.val { background: #0f3460; border-color: #1a1a4e; color: #eee; }
body.dark .metadata-row input.val[readonly] { background: #0a0a18; color: #666; }
body.dark .meta-del { color: #f88; }
body.dark .meta-del:hover { background: #4a1a1a; }

/* ==================== СЕРАЯ ТЕМА РЕДАКТОРА (светлая) ==================== */
.app .top-bar,
.app .tool-panel,
.app .right-panel {
    background: #d6d6d6;
}
.app .panel-header,
.app .status-bar {
    background: #c8c8c8;
}
.app .btn {
    background: #c0c0c0;
}
.app .btn:hover {
    background: #b0b0b0;
}
.app .btn.primary {
    background: #3b82f6;
}
.app .btn.primary:hover:not(:disabled) {
    background: #2563eb;
}
.app .btn.danger {
    background: #fee;
}
.app .btn.danger:hover {
    background: #fdd;
}
.app input[type=number],
.app input[type=text],
.app select,
.app textarea {
    background: #f0f0f0;
    border-color: #b0b0b0;
}
.app input[type=number]:focus,
.app input[type=text]:focus,
.app select:focus,
.app textarea:focus {
    border-color: #3b82f6;
}
.app .panel-section {
    border-bottom-color: #b8b8b8;
}
.app .mode-tabs {
    background: #c8c8c8;
}
.app .mode-tabs button.active {
    background: #3b82f6;
}
.app .mode-tabs button:hover:not(.active) {
    color: #222;
}
.app .layer-item {
    background: #c8c8c8;
}
.app .layer-item:hover {
    background: #b8b8b8;
}
.app .layer-item.active {
    background: #3b82f6;
    color: #fff;
}
.app .info-block .section {
    border-top-color: #b8b8b8;
}

/* Рабочее поле — темнее панелей, с шахматкой для прозрачности */
/*
.app .canvas-area {
    background-color: #bfbfbf;
    background-image:
        linear-gradient(45deg, #b0b0b0 25%, transparent 25%),
        linear-gradient(-45deg, #b0b0b0 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, #b0b0b0 75%),
        linear-gradient(-45deg, transparent 75%, #b0b0b0 75%);
    background-size: 20px 20px;
    background-position: 0 0, 0 10px, 10px -10px, -10px 0px;
}
*/

.app .canvas-area {
    background-color: #bfbfbf;
    background-image: none;
}

/* Приглашение загрузить файл — как поле */
.app .upload-zone {
    background: #bfbfbf;
}

.app .upload-zone .icon {
    margin-bottom: 20px;
}
.app .upload-zone .hint {
    margin-bottom: 0px;
}

.app .canvas-stage {
    background-color: #ffffff;
    background-image:
        linear-gradient(45deg, #d0d0d0 25%, transparent 25%),
        linear-gradient(-45deg, #d0d0d0 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, #d0d0d0 75%),
        linear-gradient(-45deg, transparent 75%, #d0d0d0 75%);
    background-size: 20px 20px;
    background-position: 0 0, 0 10px, 10px -10px, -10px 0px;
}

/* Меню инструментов в серой теме */
.app .tool-menu {
    background: #d6d6d6;
    border-color: #b0b0b0;
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
    z-index: 2000;
}
.app .tool-panel {
    z-index: 1000;
}
.app .tool-menu button {
    color: #222;
}
.app .tool-menu button:hover {
    background: #c0c0c0;
}
.app .tool-menu button.active {
    background: #3b82f6;
    color: #fff;
}
.app .tool-expand {
    background: #d6d6d6;
    border-color: #b0b0b0;
    color: #555;
}
.app .tool-expand:hover {
    background: #3b82f6;
    color: #fff;
    border-color: #3b82f6;
}