/**
 * PRESENTATION BUILDER — Стили модуля
 * Тёмный UI редактора, белый канвас слайда
 * @version 1.0.0
 */

/* ==================== OVERLAY ==================== */
.pres-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    z-index: 10000;
    background: #1c1a20;
    display: flex;
    flex-direction: column;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    color: #e8e3db;
    overflow: hidden;
}

/* ==================== HEADER / TOOLBAR ==================== */
.pres-header {
    height: 48px;
    min-height: 48px;
    background: #242229;
    border-bottom: none;
    display: flex;
    align-items: center;
    padding: 0 12px;
    gap: 8px;
    z-index: 10;
}

/* ==================== AI MODEL SELECTORS BAR ==================== */
.pres-ai-models-bar {
    height: 32px;
    min-height: 32px;
    background: #1e1c22;
    border-bottom: 1px solid rgba(232,227,219,0.07);
    display: flex;
    align-items: center;
    padding: 0 12px;
    gap: 10px;
    z-index: 10;
}

.pres-ai-models-group {
    display: flex;
    align-items: center;
    gap: 5px;
}

.pres-ai-models-label {
    font-size: 0.7rem;
    color: #6b6560;
    font-weight: 500;
    white-space: nowrap;
    letter-spacing: 0.3px;
    text-transform: uppercase;
}

.pres-ai-model-label {
    font-size: 0.72rem;
    color: #948e84;
    white-space: nowrap;
    cursor: default;
    display: flex;
    align-items: center;
    gap: 3px;
}

.pres-ai-model-label svg {
    opacity: 0.6;
}

.pres-ai-model-select {
    background: rgba(255,250,243,0.04);
    border: 1px solid rgba(232,227,219,0.10);
    color: #e8e3db;
    padding: 2px 22px 2px 6px;
    border-radius: 4px;
    font-size: 0.72rem;
    font-family: inherit;
    outline: none;
    cursor: pointer;
    height: 24px;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 24 24' fill='none' stroke='%23948e84' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 5px center;
    background-size: 10px;
}

.pres-ai-model-select:hover {
    border-color: rgba(232,227,219,0.20);
}

.pres-ai-model-select:focus {
    border-color: #c9995e;
}

.pres-ai-model-select option {
    background: #2a2830;
    color: #e8e3db;
}

.pres-ai-models-sep {
    width: 1px;
    height: 16px;
    background: rgba(232,227,219,0.08);
    flex-shrink: 0;
}

.pres-header-left {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
}

.pres-header-center {
    display: flex;
    align-items: center;
    gap: 6px;
}

.pres-header-right {
    display: flex;
    align-items: center;
    gap: 6px;
    flex: 1;
    justify-content: flex-end;
}

.pres-name-input {
    background: transparent;
    border: 1px solid transparent;
    color: #e8e3db;
    font-size: 0.95rem;
    font-weight: 600;
    padding: 4px 8px;
    border-radius: 4px;
    width: 220px;
    outline: none;
}

.pres-name-input:hover {
    border-color: rgba(232,227,219,0.10);
}

.pres-name-input:focus {
    border-color: #c9995e;
    background: rgba(255,250,243,0.04);
}

.pres-btn {
    background: transparent;
    border: 1px solid rgba(232,227,219,0.10);
    color: #e8e3db;
    padding: 6px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.82rem;
    display: flex;
    align-items: center;
    gap: 5px;
    transition: all 0.2s;
    white-space: nowrap;
    font-family: inherit;
}

.pres-btn:hover {
    background: rgba(255,250,243,0.07);
    border-color: rgba(232,227,219,0.15);
}

.pres-btn.primary {
    background: rgba(201,153,94,0.15);
    border-color: rgba(201,153,94,0.3);
    color: #c9995e;
}

.pres-btn.primary:hover {
    background: rgba(201,153,94,0.25);
}

.pres-btn.danger {
    color: #d4706a;
}

.pres-btn.danger:hover {
    background: rgba(212,112,106,0.12);
    border-color: rgba(212,112,106,0.3);
}

.pres-btn-icon {
    padding: 6px;
    min-width: 32px;
    justify-content: center;
}

.pres-close-btn {
    background: transparent;
    border: none;
    color: #948e84;
    padding: 6px;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    transition: all 0.2s;
}

.pres-close-btn:hover {
    background: rgba(212,112,106,0.15);
    color: #d4706a;
}

/* ==================== BODY LAYOUT ==================== */
.pres-body {
    flex: 1;
    display: flex;
    overflow: hidden;
    min-height: 0;
}

/* ==================== LEFT PALETTE ==================== */
.pres-palette {
    width: 130px;
    min-width: 130px;
    background: #242229;
    border-right: 1px solid rgba(232,227,219,0.07);
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 8px 0;
    gap: 4px;
    overflow-y: auto;
}

.pres-palette-label {
    font-size: 0.65rem;
    color: #6b6560;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
    user-select: none;
}

.pres-palette-item {
    width: 114px;
    height: 42px;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: flex-start;
    border-radius: 6px;
    cursor: grab;
    transition: all 0.2s;
    color: #948e84;
    gap: 6px;
    user-select: none;
    border: 1px solid transparent;
    padding: 0 8px;
}

.pres-palette-item:hover {
    background: rgba(255,250,243,0.07);
    color: #e8e3db;
    border-color: rgba(232,227,219,0.10);
}

.pres-palette-item:active {
    cursor: grabbing;
}

.pres-palette-item.dragging {
    opacity: 0.5;
}

.pres-palette-item svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.pres-palette-item-label {
    font-size: 0.68rem;
    letter-spacing: 0.2px;
    white-space: nowrap;
}

.pres-palette-sep {
    width: 106px;
    height: 1px;
    background: rgba(232,227,219,0.07);
    margin: 4px 0;
}

/* ==================== CANVAS AREA ==================== */
.pres-canvas-area {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #1c1a20;
    overflow: hidden;
    position: relative;
    padding: 16px;
}

.pres-canvas-wrapper {
    position: relative;
    box-shadow: 0 4px 24px rgba(0,0,0,0.4);
    border-radius: 2px;
}

.pres-canvas {
    width: 1500px;
    height: 1000px;
    background: #ffffff;
    position: relative;
    overflow: hidden;
    transform-origin: top left;
}

/* Grid overlay */
.pres-canvas-grid {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    pointer-events: none;
    z-index: 1;
    opacity: 0;
    transition: opacity 0.3s;
    background-image:
        linear-gradient(rgba(0,0,0,0.04) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0,0,0,0.04) 1px, transparent 1px);
    background-size: 10px 10px;
}

.pres-canvas.show-grid .pres-canvas-grid {
    opacity: 1;
}

/* Drop indicator */
.pres-drop-indicator {
    position: absolute;
    border: 2px dashed #c9995e;
    background: rgba(201,153,94,0.08);
    border-radius: 4px;
    pointer-events: none;
    z-index: 100;
    display: none;
}

/* ==================== BLOCKS ==================== */
.pres-block {
    position: absolute;
    z-index: 5;
    cursor: move;
    border: 2px solid transparent;
    border-radius: 3px;
    transition: border-color 0.15s;
    box-sizing: border-box;
    overflow: hidden;
}

.pres-block:hover {
    border-color: rgba(49,130,206,0.3);
}

.pres-block.selected {
    border-color: #3182ce;
    z-index: 10;
}

/* Rubber-band selection rectangle */
.pres-rubber-band {
    position: absolute;
    border: 1.5px dashed #3182ce;
    background: rgba(49, 130, 206, 0.08);
    pointer-events: none;
    z-index: 9999;
    border-radius: 2px;
}

.pres-block.editing {
    overflow: visible;
    z-index: 50;
}

.pres-block.editing .pres-block-content {
    overflow: visible;
}

.pres-canvas.has-editing {
    overflow: visible;
}

.pres-canvas-wrapper.has-editing {
    overflow: visible;
}

.pres-block.dragging {
    opacity: 0.7;
    z-index: 50;
}

/* Connection drawing states */
.pres-block.connection-source {
    border-color: #c9995e !important;
    box-shadow: 0 0 0 3px rgba(201, 153, 94, 0.3);
}

.pres-block.connection-target {
    border-color: #48bb78 !important;
    box-shadow: 0 0 0 3px rgba(72, 187, 120, 0.3);
}

/* Connection lines */
.pres-connection-line {
    transition: stroke-width 0.15s;
}

.pres-connection-line:hover {
    stroke-width: 4 !important;
    filter: drop-shadow(0 0 4px rgba(201, 153, 94, 0.5));
}

.pres-block-content {
    width: 100%;
    height: 100%;
    overflow: hidden;
    position: relative;
}

/* Block type placeholders */
.pres-block-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #a0aec0;
    gap: 6px;
    background: #f7fafc;
    border: 1px dashed #cbd5e0;
    border-radius: 2px;
    cursor: pointer;
}

.pres-block-placeholder svg {
    width: 32px;
    height: 32px;
    opacity: 0.5;
}

.pres-block-placeholder span {
    font-size: 0.75rem;
}

/* Resize handles */
.pres-resize-handle {
    position: absolute;
    width: 10px;
    height: 10px;
    background: #3182ce;
    border: 2px solid #ffffff;
    border-radius: 2px;
    z-index: 20;
    display: none;
}

.pres-block.selected .pres-resize-handle {
    display: block;
}

.pres-resize-handle.nw { top: -5px; left: -5px; cursor: nw-resize; }
.pres-resize-handle.ne { top: -5px; right: -5px; cursor: ne-resize; }
.pres-resize-handle.sw { bottom: -5px; left: -5px; cursor: sw-resize; }
.pres-resize-handle.se { bottom: -5px; right: -5px; cursor: se-resize; }
.pres-resize-handle.n  { top: -5px; left: 50%; transform: translateX(-50%); cursor: n-resize; }
.pres-resize-handle.s  { bottom: -5px; left: 50%; transform: translateX(-50%); cursor: s-resize; }
.pres-resize-handle.e  { top: 50%; right: -5px; transform: translateY(-50%); cursor: e-resize; }
.pres-resize-handle.w  { top: 50%; left: -5px; transform: translateY(-50%); cursor: w-resize; }

/* Crop / Mask node handles */
.pres-block.mask-editing {
    overflow: visible;
    z-index: 50;
    border-color: rgba(201, 153, 94, 0.5) !important;
}
.pres-block.mask-editing .pres-block-content {
    overflow: visible;
}
.pres-block.mask-editing .pres-resize-handle {
    display: none !important;
}
.pres-mask-node-handle {
    position: absolute;
    width: 10px;
    height: 10px;
    background: #c9995e;
    border: 2px solid #ffffff;
    border-radius: 50%;
    z-index: 30;
    cursor: grab;
    transition: transform 0.1s;
    box-shadow: 0 1px 4px rgba(0,0,0,0.3);
}
.pres-mask-node-handle.crop-handle {
    width: 12px;
    height: 12px;
    border-radius: 2px;
}
.pres-mask-node-handle:hover {
    transform: scale(1.3);
    background: #e0b070;
}
.pres-mask-node-handle:active {
    transform: scale(1.1);
    cursor: grabbing;
}
.pres-mask-edge-overlay {
    position: absolute;
    width: 8px;
    height: 8px;
    background: rgba(201, 153, 94, 0.35);
    border: 1.5px dashed #c9995e;
    border-radius: 50%;
    z-index: 28;
    cursor: crosshair;
    transition: transform 0.15s, background 0.15s;
}
.pres-mask-edge-overlay:hover {
    transform: scale(1.5);
    background: rgba(201, 153, 94, 0.7);
}
/* Crop overlay (dimmed areas) */
.pres-crop-overlay {
    pointer-events: none;
    z-index: 25;
}
/* Image block with imgCrop - needs overflow hidden for positioned img */
.pres-block[data-type="image"] .pres-block-content {
    position: relative;
    overflow: hidden;
}

/* ==================== SHAPES ==================== */
.pres-shape {
    position: absolute;
    user-select: none;
}
.pres-shape svg {
    pointer-events: none;
}
.pres-shape:hover {
    filter: brightness(1.08);
}
.pres-shape.selected {
    outline: 2px solid #c9995e;
    outline-offset: 2px;
}
.pres-shape .pres-resize-handle {
    display: none;
    background: #c9995e;
}
.pres-shape.selected .pres-resize-handle {
    display: block;
}
.pres-canvas.shape-drawing-mode {
    cursor: crosshair;
}

/* Shape tool items in palette */
.pres-shape-tool-item {
    cursor: pointer;
    padding: 6px 10px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.78rem;
    color: rgba(232,227,219,0.7);
    transition: background 0.15s;
}
.pres-shape-tool-item:hover {
    background: rgba(255,250,243,0.07);
    color: #e8e3db;
}
.pres-shape-tool-item.active {
    background: rgba(201,153,94,0.2);
    color: #c9995e;
}
.pres-shape-tool-item svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

/* Shape properties panel */
.pres-shape-props {
    position: fixed;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 99999;
    background: #1e1c24;
    border: 1px solid rgba(232,227,219,0.1);
    border-radius: 10px;
    padding: 14px;
    width: 220px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.4);
    color: #e8e3db;
    font-size: 0.82rem;
}
.pres-shape-props-title {
    font-weight: 600;
    margin-bottom: 10px;
    font-size: 0.88rem;
    color: #c9995e;
}
.pres-shape-props-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}
.pres-shape-props-row label {
    flex-shrink: 0;
    width: 70px;
    font-size: 0.78rem;
    color: #948e84;
}
.pres-shape-props-row input[type="color"] {
    width: 28px;
    height: 24px;
    border: 1px solid rgba(232,227,219,0.15);
    border-radius: 4px;
    background: transparent;
    cursor: pointer;
    padding: 0;
}
.pres-shape-props-row input[type="range"] {
    flex: 1;
    accent-color: #c9995e;
}
.pres-shape-props-row input[type="number"] {
    background: #1c1a20;
    color: #e8e3db;
    border: 1px solid rgba(232,227,219,0.12);
    border-radius: 4px;
    padding: 3px 6px;
    font-size: 0.78rem;
}
.pres-shape-props-row select {
    flex: 1;
    background: #1c1a20;
    color: #e8e3db;
    border: 1px solid rgba(232,227,219,0.12);
    border-radius: 4px;
    padding: 3px 6px;
    font-size: 0.78rem;
}
.pres-shape-props-actions {
    margin-top: 6px;
    gap: 6px;
    justify-content: flex-end;
}
.pres-shape-props-actions .pres-btn.danger {
    background: rgba(212,112,106,0.15);
    color: #d4706a;
}
.pres-shape-props-actions .pres-btn.danger:hover {
    background: rgba(212,112,106,0.25);
}

/* ==================== ZOOM CONTROLS ==================== */
.pres-zoom-controls {
    display: flex;
    align-items: center;
    gap: 4px;
}
.pres-zoom-level {
    font-size: 0.78rem;
    color: #948e84;
    min-width: 40px;
    text-align: center;
    font-weight: 500;
}
.pres-zoom-btn {
    width: 28px !important;
    height: 28px !important;
    padding: 0 !important;
    display: flex !important;
    align-items: center;
    justify-content: center;
}
.pres-zoom-btn svg {
    width: 14px;
    height: 14px;
}

/* Tool button active state */
.pres-tool-btn.active {
    background: rgba(201,153,94,0.2) !important;
    color: #c9995e !important;
}

/* Block context menu button */
.pres-block-menu-btn {
    position: absolute;
    top: 2px;
    right: 2px;
    width: 20px;
    height: 20px;
    background: rgba(0,0,0,0.5);
    color: #fff;
    border: none;
    border-radius: 3px;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    z-index: 15;
    padding: 0;
    line-height: 1;
}

.pres-block.selected .pres-block-menu-btn,
.pres-block:hover .pres-block-menu-btn {
    display: flex;
}

/* Text block */
.pres-block[data-type="text"] .pres-text-content {
    width: 100%;
    height: 100%;
    padding: 8px 12px;
    font-size: 18px;
    line-height: 1.4;
    color: #2d3748;
    overflow: hidden;
    word-wrap: break-word;
    outline: none;
}

.pres-block[data-type="text"] .pres-text-content[contenteditable="true"] {
    cursor: text;
    background: rgba(49,130,206,0.03);
}

/* Image block */
.pres-block[data-type="image"] img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

/* Video block */
.pres-block[data-type="video"] iframe,
.pres-block[data-type="video"] video {
    width: 100%;
    height: 100%;
    border: none;
    display: block;
}

/* Table block */
.pres-block[data-type="table"] table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
    color: #2d3748;
}

.pres-block[data-type="table"] th,
.pres-block[data-type="table"] td {
    border: 1px solid #e2e8f0;
    padding: 6px 10px;
    text-align: left;
}

.pres-block[data-type="table"] th {
    background: #edf2f7;
    font-weight: 600;
    font-size: 13px;
}

.pres-block[data-type="table"] td[contenteditable="true"],
.pres-block[data-type="table"] th[contenteditable="true"] {
    outline: none;
    background: rgba(49,130,206,0.03);
}

/* Chart block */
.pres-block[data-type="chart"] canvas {
    width: 100% !important;
    height: 100% !important;
}

/* ==================== SLIDES PANEL (bottom) ==================== */
.pres-slides-panel {
    height: 110px;
    min-height: 110px;
    background: #242229;
    border-top: 1px solid rgba(232,227,219,0.07);
    display: flex;
    align-items: center;
    padding: 0 12px;
    gap: 8px;
    overflow-x: auto;
    z-index: 10;
}

.pres-slides-panel::-webkit-scrollbar {
    height: 4px;
}
.pres-slides-panel::-webkit-scrollbar-thumb {
    background: rgba(232,227,219,0.10);
    border-radius: 2px;
}

.pres-slide-thumb {
    min-width: 120px;
    width: 120px;
    height: 82px;
    background: #fff;
    border: 2px solid transparent;
    border-radius: 4px;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    flex-shrink: 0;
    transition: border-color 0.2s;
}

.pres-slide-thumb:hover {
    border-color: rgba(49,130,206,0.4);
}

.pres-slide-thumb.active {
    border-color: #3182ce;
}

.pres-slide-thumb-content {
    width: 1500px;
    height: 1000px;
    transform: scale(0.08);
    transform-origin: top left;
    pointer-events: none;
    position: absolute;
    top: 0;
    left: 0;
}

.pres-slide-thumb-number {
    position: absolute;
    bottom: 2px;
    left: 4px;
    font-size: 0.6rem;
    color: #948e84;
    user-select: none;
}

.pres-slide-thumb-delete {
    position: absolute;
    top: 2px;
    right: 2px;
    width: 16px;
    height: 16px;
    background: rgba(0,0,0,0.5);
    color: #fff;
    border: none;
    border-radius: 2px;
    cursor: pointer;
    font-size: 10px;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 0;
    line-height: 1;
}

.pres-slide-thumb:hover .pres-slide-thumb-delete {
    display: flex;
}

.pres-add-slide-btn {
    min-width: 60px;
    width: 60px;
    height: 82px;
    border: 2px dashed rgba(232,227,219,0.15);
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #6b6560;
    font-size: 24px;
    background: transparent;
    flex-shrink: 0;
    transition: all 0.2s;
}

.pres-add-slide-btn:hover {
    border-color: rgba(201,153,94,0.4);
    color: #c9995e;
    background: rgba(201,153,94,0.05);
}

/* ==================== AI DIALOG ==================== */
.pres-ai-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.6);
    z-index: 10100;
    display: flex;
    align-items: center;
    justify-content: center;
}

.pres-ai-dialog {
    background: #242229;
    border: 1px solid rgba(232,227,219,0.10);
    border-radius: 10px;
    width: 720px;
    max-width: 95vw;
    max-height: 85vh;
    box-shadow: 0 8px 32px rgba(0,0,0,0.4);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
}

.pres-ai-resize-handle {
    position: absolute;
    right: 0; bottom: 0;
    width: 18px; height: 18px;
    cursor: nwse-resize;
    z-index: 10;
}

.pres-ai-resize-handle::after {
    content: '';
    position: absolute;
    right: 4px; bottom: 4px;
    width: 8px; height: 8px;
    border-right: 2px solid rgba(232,227,219,0.2);
    border-bottom: 2px solid rgba(232,227,219,0.2);
}

.pres-ai-resize-handle:hover::after {
    border-color: rgba(201,153,94,0.5);
}

.pres-ai-dialog-header {
    padding: 12px 20px;
    border-bottom: 1px solid rgba(232,227,219,0.07);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
    gap: 12px;
    cursor: move;
    user-select: none;
}

.pres-ai-dialog-header h3 {
    font-size: 0.95rem;
    font-weight: 600;
    color: #e8e3db;
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
}

.pres-ai-dialog-header-actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
    align-items: center;
}

.pres-ai-dialog-header .pres-close-btn {
    display: none;
}

.pres-ai-dialog-body {
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    overflow-x: hidden;
    overflow-y: auto;
    flex: 1 1 auto;
    min-height: 0;
}

.pres-ai-field label {
    display: block;
    font-size: 0.78rem;
    color: #948e84;
    margin-bottom: 6px;
}

.pres-ai-field textarea,
.pres-ai-field input,
.pres-ai-field select {
    width: 100%;
    background: rgba(255,250,243,0.04);
    border: 1px solid rgba(232,227,219,0.10);
    color: #e8e3db;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 0.88rem;
    font-family: inherit;
    outline: none;
    resize: vertical;
    box-sizing: border-box;
}

.pres-ai-field input[type="color"] {
    width: 36px;
    height: 36px;
    padding: 2px;
    cursor: pointer;
    background: transparent;
    flex-shrink: 0;
}

.pres-ai-field textarea {
    min-height: 80px;
}

.pres-ai-field textarea:focus,
.pres-ai-field input:focus,
.pres-ai-field select:focus {
    border-color: #c9995e;
}

.pres-ai-field select option {
    background: #242229;
    color: #e8e3db;
}

.pres-ai-dialog-footer {
    padding: 16px 20px;
    border-top: 1px solid rgba(232,227,219,0.07);
    display: none;
    justify-content: flex-end;
    gap: 8px;
    flex-shrink: 0;
}

/* === Enhanced AI Slide Modal === */
.pres-ai-section-title {
    font-size: 0.78rem;
    font-weight: 600;
    color: #c9995e;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-top: 4px;
    padding-bottom: 4px;
    border-bottom: 1px solid rgba(201,153,94,0.15);
}

.pres-ai-content-types {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.pres-ai-type-check {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
    color: #e8e3db;
    transition: background 0.15s;
    user-select: none;
}

.pres-ai-type-check:hover {
    background: rgba(255,250,243,0.04);
}

.pres-ai-type-check input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: #c9995e;
    cursor: pointer;
    flex-shrink: 0;
}

.pres-ai-type-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    color: #948e84;
    flex-shrink: 0;
}

.pres-ai-type-icon svg {
    width: 16px;
    height: 16px;
}

.pres-ai-sub-options {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-left: 42px;
    padding: 8px 12px;
    background: rgba(255,250,243,0.02);
    border-left: 2px solid rgba(201,153,94,0.25);
    border-radius: 0 6px 6px 0;
    box-sizing: border-box;
}

.pres-ai-sub-options textarea,
.pres-ai-sub-options select {
    width: 100%;
    background: rgba(255,250,243,0.04);
    border: 1px solid rgba(232,227,219,0.10);
    color: #e8e3db;
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 0.82rem;
    font-family: inherit;
    outline: none;
    resize: vertical;
    box-sizing: border-box;
}

.pres-ai-sub-options textarea:focus,
.pres-ai-sub-options select:focus {
    border-color: #c9995e;
}

.pres-ai-sub-options select option {
    background: #242229;
    color: #e8e3db;
}

.pres-ai-hint {
    font-size: 0.72rem;
    color: #6b6560;
    line-height: 1.3;
}

.pres-ai-bg-row {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.pres-ai-field .pres-ai-color-picker {
    width: 36px;
    height: 36px;
    border: 1px solid rgba(232,227,219,0.10);
    border-radius: 6px;
    background: transparent;
    cursor: pointer;
    padding: 2px;
    flex-shrink: 0;
}

.pres-ai-color-picker::-webkit-color-swatch-wrapper {
    padding: 0;
}

.pres-ai-color-picker::-webkit-color-swatch {
    border: none;
    border-radius: 4px;
}

.pres-ai-bg-presets {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.pres-ai-bg-swatch {
    width: 26px;
    height: 26px;
    border-radius: 5px;
    cursor: pointer;
    border: 2px solid transparent;
    transition: border-color 0.15s, transform 0.1s;
    flex-shrink: 0;
}

.pres-ai-bg-swatch:hover {
    transform: scale(1.15);
}

.pres-ai-bg-swatch.active {
    border-color: #c9995e;
}

.pres-ai-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    color: #948e84;
    font-size: 0.82rem;
    padding: 8px 0;
}

.pres-ai-spinner {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(201,153,94,0.2);
    border-top-color: #c9995e;
    border-radius: 50%;
    animation: pres-spin 0.8s linear infinite;
}

.pres-ai-progress-text {
    text-align: center;
}

@keyframes pres-spin {
    to { transform: rotate(360deg); }
}

/* ==================== CONTEXT MENU ==================== */
.pres-context-menu {
    position: fixed;
    z-index: 10200;
    background: #2a2830;
    border: 1px solid rgba(232,227,219,0.10);
    border-radius: 8px;
    padding: 4px 0;
    min-width: 180px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.4);
}

.pres-context-item {
    padding: 7px 16px;
    cursor: pointer;
    font-size: 0.82rem;
    color: #e8e3db;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: background 0.15s;
}

.pres-context-item:hover {
    background: rgba(255,250,243,0.07);
}

.pres-context-item.danger {
    color: #d4706a;
}

.pres-context-sep {
    height: 1px;
    background: rgba(232,227,219,0.07);
    margin: 4px 0;
}

/* ==================== BLOCK TEXT TOOLBAR ==================== */
.pres-text-toolbar {
    position: absolute;
    bottom: calc(100% + 6px);
    left: 0;
    background: #2a2830;
    border: 1px solid rgba(232,227,219,0.12);
    border-radius: 8px;
    padding: 5px 8px;
    display: flex;
    flex-wrap: wrap;
    gap: 3px;
    z-index: 200;
    box-shadow: 0 4px 16px rgba(0,0,0,0.4);
    min-width: 380px;
    max-width: 540px;
    align-items: center;
}

.pres-text-toolbar .pres-tb-sep {
    width: 1px;
    height: 20px;
    background: rgba(232,227,219,0.10);
    margin: 0 2px;
    flex-shrink: 0;
}

.pres-text-toolbar button {
    background: transparent;
    border: none;
    color: #e8e3db;
    padding: 4px 6px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.78rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s;
    font-family: inherit;
    min-width: 26px;
    height: 26px;
    line-height: 1;
    position: relative;
}

.pres-text-toolbar button:hover {
    background: rgba(255,250,243,0.10);
}

.pres-text-toolbar button.active {
    background: rgba(201,153,94,0.2);
    color: #c9995e;
}

.pres-text-toolbar select {
    background: #2a2830;
    border: 1px solid rgba(232,227,219,0.10);
    color: #e8e3db;
    padding: 3px 4px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-family: inherit;
    outline: none;
    height: 26px;
    cursor: pointer;
}

.pres-text-toolbar select option {
    background: #2a2830;
    color: #e8e3db;
}

/* Color picker wrapper */
.pres-tb-color-wrap {
    position: relative;
    display: inline-flex;
    align-items: center;
}

.pres-tb-color-wrap input[type="color"] {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    opacity: 0;
    cursor: pointer;
    border: none;
    padding: 0;
}

.pres-tb-color-swatch {
    width: 14px;
    height: 4px;
    border-radius: 1px;
    position: absolute;
    bottom: 2px;
    left: 50%;
    transform: translateX(-50%);
    pointer-events: none;
}

/* ==================== IMAGE / VIDEO EDIT DIALOG ==================== */
.pres-media-dialog {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: #2a2830;
    border: 1px solid rgba(232,227,219,0.10);
    border-radius: 8px;
    padding: 16px;
    z-index: 30;
    min-width: 260px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.4);
}

.pres-media-dialog input {
    width: 100%;
    background: rgba(255,250,243,0.04);
    border: 1px solid rgba(232,227,219,0.10);
    color: #e8e3db;
    padding: 8px 10px;
    border-radius: 6px;
    font-size: 0.85rem;
    font-family: inherit;
    outline: none;
    margin-bottom: 8px;
}

.pres-media-dialog input:focus {
    border-color: #c9995e;
}

/* ==================== CHART EDITOR ==================== */
.pres-chart-editor {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: #2a2830;
    border: 1px solid rgba(232,227,219,0.10);
    border-radius: 8px;
    padding: 16px;
    z-index: 30;
    min-width: 320px;
    max-height: 400px;
    overflow-y: auto;
    box-shadow: 0 4px 16px rgba(0,0,0,0.4);
}

.pres-chart-editor label {
    display: block;
    font-size: 0.75rem;
    color: #948e84;
    margin-bottom: 4px;
}

.pres-chart-editor input,
.pres-chart-editor select {
    width: 100%;
    background: rgba(255,250,243,0.04);
    border: 1px solid rgba(232,227,219,0.10);
    color: #e8e3db;
    padding: 6px 8px;
    border-radius: 4px;
    font-size: 0.82rem;
    font-family: inherit;
    outline: none;
    margin-bottom: 8px;
}

/* ==================== NOTIFICATIONS ==================== */
.pres-notification {
    position: fixed;
    top: 60px;
    right: 16px;
    background: #2a2830;
    border: 1px solid rgba(232,227,219,0.10);
    border-radius: 8px;
    padding: 10px 16px;
    color: #e8e3db;
    font-size: 0.82rem;
    z-index: 10300;
    box-shadow: 0 4px 16px rgba(0,0,0,0.4);
    animation: pres-slide-in 0.3s ease;
    max-width: 350px;
}

.pres-notification.success {
    border-color: rgba(93,184,122,0.3);
}

.pres-notification.error {
    border-color: rgba(212,112,106,0.3);
}

@keyframes pres-slide-in {
    from { opacity: 0; transform: translateX(20px); }
    to { opacity: 1; transform: translateX(0); }
}

/* ==================== SCROLLBAR ==================== */
.pres-overlay ::-webkit-scrollbar { width: 5px; }
.pres-overlay ::-webkit-scrollbar-thumb { background: rgba(232,227,219,0.10); border-radius: 3px; }
.pres-overlay ::-webkit-scrollbar-thumb:hover { background: rgba(232,227,219,0.18); }

/* ==================== SLIDE BACKGROUND SELECTOR ==================== */
.pres-bg-picker {
    display: flex;
    flex-wrap: wrap;
    gap: 3px;
    justify-content: center;
    width: 42px;
    padding: 2px 0;
}

.pres-bg-swatch {
    width: 12px;
    height: 12px;
    border-radius: 2px;
    border: 1.5px solid transparent;
    cursor: pointer;
    transition: border-color 0.15s;
    flex-shrink: 0;
}

.pres-bg-swatch:hover,
.pres-bg-swatch.active {
    border-color: #c9995e;
}

/* ==================== TEMPLATE PICKER ==================== */
.pres-tmpl-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 8px;
    margin: 4px 0 10px;
}

.pres-tmpl-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 6px 4px;
    border: 1.5px solid rgba(232, 227, 219, 0.07);
    border-radius: 8px;
    background: rgba(255, 250, 243, 0.03);
    cursor: pointer;
    transition: all 0.18s;
}

.pres-tmpl-item:hover {
    border-color: rgba(232, 227, 219, 0.18);
    background: rgba(255, 250, 243, 0.06);
}

.pres-tmpl-item.active {
    border-color: #c9995e;
    background: rgba(201, 153, 94, 0.10);
    box-shadow: 0 0 0 1px rgba(201, 153, 94, 0.25);
}

.pres-tmpl-svg {
    width: 100%;
    aspect-ratio: 3 / 2;
    background: rgba(255, 255, 255, 0.04);
    border-radius: 4px;
    border: 1px solid rgba(232, 227, 219, 0.06);
}

.pres-tmpl-item.active .pres-tmpl-svg {
    border-color: rgba(201, 153, 94, 0.20);
}

.pres-tmpl-name {
    font-size: 0.62rem;
    color: #948e84;
    text-align: center;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

.pres-tmpl-item.active .pres-tmpl-name {
    color: #c9995e;
}

/* ==================== AI BLOCK PANEL (right side) ==================== */
.pres-ai-panel {
    position: fixed;
    background: #2a2830;
    border: 1px solid rgba(232,227,219,0.12);
    border-radius: 10px;
    padding: 14px;
    z-index: 10200;
    box-shadow: 0 4px 20px rgba(0,0,0,0.45);
    width: 320px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.pres-ai-panel-title {
    font-size: 0.82rem;
    font-weight: 600;
    color: #e8e3db;
    display: flex;
    align-items: center;
    gap: 6px;
    padding-bottom: 6px;
    border-bottom: 1px solid rgba(232,227,219,0.07);
}

.pres-ai-panel-title svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

.pres-ai-panel .pres-ai-p-label {
    font-size: 0.72rem;
    color: #948e84;
    margin-bottom: 4px;
    display: block;
}

.pres-ai-panel textarea {
    width: 100%;
    background: rgba(255,250,243,0.04);
    border: 1px solid rgba(232,227,219,0.10);
    color: #e8e3db;
    padding: 8px 10px;
    border-radius: 6px;
    font-size: 0.82rem;
    font-family: inherit;
    outline: none;
    resize: vertical;
    min-height: 64px;
    box-sizing: border-box;
}

.pres-ai-panel textarea:focus {
    border-color: #c9995e;
}

.pres-ai-panel select {
    width: 100%;
    background: #2a2830;
    border: 1px solid rgba(232,227,219,0.10);
    color: #e8e3db;
    padding: 6px 8px;
    border-radius: 6px;
    font-size: 0.78rem;
    font-family: inherit;
    outline: none;
    cursor: pointer;
    box-sizing: border-box;
}

.pres-ai-panel select:focus {
    border-color: #c9995e;
}

.pres-ai-panel select option {
    background: #2a2830;
    color: #e8e3db;
}

.pres-ai-panel-rag-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 0;
}

.pres-ai-panel-rag-toggle input[type="checkbox"] {
    accent-color: #c9995e;
    width: 15px;
    height: 15px;
    cursor: pointer;
}

.pres-ai-panel-rag-toggle label {
    font-size: 0.78rem;
    color: #e8e3db;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 5px;
    user-select: none;
}

.pres-ai-panel-rag-toggle label svg {
    width: 14px;
    height: 14px;
}

.pres-ai-panel-rag-section {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 8px;
    background: rgba(201,153,94,0.05);
    border: 1px solid rgba(201,153,94,0.12);
    border-radius: 6px;
}

.pres-ai-panel-rag-section .pres-ai-p-hint {
    font-size: 0.68rem;
    color: #6b6560;
    line-height: 1.3;
}

.pres-ai-panel-footer {
    display: flex;
    gap: 6px;
    padding-top: 6px;
    border-top: 1px solid rgba(232,227,219,0.07);
}

.pres-ai-panel-footer .pres-btn {
    flex: 1;
}

.pres-ai-panel .pres-ai-panel-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    color: #948e84;
    font-size: 0.78rem;
    padding: 4px 0;
}

.pres-ai-panel .pres-ai-panel-loading .pres-ai-spinner {
    width: 14px;
    height: 14px;
}

/* ==================== KEYBOARD SHORTCUT HINT ==================== */
.pres-shortcut-hint {
    font-size: 0.65rem;
    color: #6b6560;
    margin-left: auto;
}

/* ==================== AI CHAT PANEL ==================== */
.pres-ai-chat-panel {
    width: 420px !important;
    min-width: 320px;
    max-width: 700px;
    max-height: 85vh;
    min-height: 260px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.pres-ai-chat-panel .pres-ai-resize-handle {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 18px;
    height: 18px;
    cursor: nwse-resize;
    z-index: 2;
    display: flex;
    align-items: flex-end;
    justify-content: flex-end;
    padding: 2px;
    color: rgba(232, 227, 219, 0.2);
    transition: color 0.15s;
}

.pres-ai-chat-panel .pres-ai-resize-handle:hover {
    color: rgba(201, 153, 94, 0.5);
}

.pres-ai-chat-panel .pres-ai-panel-body {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
    overflow-y: auto;
    min-height: 0;
    scrollbar-width: thin;
    scrollbar-color: rgba(232,227,219,0.10) transparent;
}
.pres-ai-chat-panel .pres-ai-panel-body::-webkit-scrollbar { width: 5px; }
.pres-ai-chat-panel .pres-ai-panel-body::-webkit-scrollbar-thumb { background: rgba(232,227,219,0.10); border-radius: 3px; }

.pres-ai-chat-messages {
    flex: 1 1 auto;
    overflow-y: auto;
    max-height: 260px;
    min-height: 80px;
    padding: 8px 2px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    scrollbar-width: thin;
    scrollbar-color: rgba(232,227,219,0.10) transparent;
}
.pres-ai-chat-messages::-webkit-scrollbar { width: 5px; }
.pres-ai-chat-messages::-webkit-scrollbar-thumb { background: rgba(232,227,219,0.10); border-radius: 3px; }
.pres-ai-chat-messages::-webkit-scrollbar-thumb:hover { background: rgba(232,227,219,0.18); }

.pres-ai-chat-empty {
    color: #6b6560;
    font-size: 0.78rem;
    text-align: center;
    padding: 24px 12px;
    line-height: 1.5;
}

.pres-ai-chat-msg {
    display: flex;
    gap: 8px;
    align-items: flex-start;
    padding: 8px 10px;
    border-radius: 8px;
    font-size: 0.82rem;
    line-height: 1.5;
}

.pres-ai-chat-user {
    background: rgba(201, 153, 94, 0.10);
    border: 1px solid rgba(201, 153, 94, 0.15);
}

.pres-ai-chat-assistant {
    background: rgba(232, 227, 219, 0.04);
    border: 1px solid rgba(232, 227, 219, 0.07);
}

.pres-ai-chat-icon {
    flex-shrink: 0;
    width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    margin-top: 1px;
}

.pres-ai-chat-user .pres-ai-chat-icon {
    background: rgba(201, 153, 94, 0.18);
    color: #c9995e;
}

.pres-ai-chat-assistant .pres-ai-chat-icon {
    background: rgba(107, 159, 212, 0.15);
    color: #6b9fd4;
}

.pres-ai-chat-text {
    flex: 1 1 auto;
    min-width: 0;
    word-break: break-word;
    color: #e8e3db;
}

.pres-ai-chat-user .pres-ai-chat-text {
    color: #e8e3db;
}

.pres-ai-chat-assistant .pres-ai-chat-text {
    color: #d0cbc3;
}

.pres-ai-chat-input-row {
    display: flex;
    gap: 6px;
    align-items: flex-end;
    padding-top: 6px;
    border-top: 1px solid rgba(232, 227, 219, 0.07);
    margin-top: 4px;
}

.pres-ai-chat-input-row textarea {
    flex: 1 1 auto;
    min-height: 36px;
    max-height: 80px;
    resize: vertical;
}

.pres-ai-chat-send {
    flex-shrink: 0;
    min-width: 36px;
    height: 36px;
    padding: 0 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    font-size: 0.8rem;
}

/* ==================== IMAGE STYLE PICKER ==================== */
.pres-ai-image-styles {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 8px 0;
    border-top: 1px solid rgba(232, 227, 219, 0.07);
    border-bottom: 1px solid rgba(232, 227, 219, 0.07);
}

.pres-ai-image-styles-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: #948e84;
    display: flex;
    align-items: center;
    gap: 5px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.pres-ai-image-styles-label svg {
    color: #c9995e;
}

.pres-ai-image-styles-grid {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding: 2px;
    scrollbar-width: thin;
    scrollbar-color: rgba(232,227,219,0.10) transparent;
}
.pres-ai-image-styles-grid::-webkit-scrollbar { height: 4px; }
.pres-ai-image-styles-grid::-webkit-scrollbar-thumb { background: rgba(232,227,219,0.10); border-radius: 3px; }

.pres-ai-style-card {
    flex-shrink: 0;
    width: 90px;
    cursor: pointer;
    border-radius: 8px;
    border: 2px solid transparent;
    padding: 4px;
    transition: border-color 0.15s, background 0.15s, transform 0.1s;
    background: rgba(255, 250, 243, 0.03);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.pres-ai-style-card:hover {
    border-color: rgba(201, 153, 94, 0.3);
    background: rgba(255, 250, 243, 0.06);
    transform: translateY(-1px);
}

.pres-ai-style-card.selected {
    border-color: #c9995e;
    background: rgba(201, 153, 94, 0.08);
}

.pres-ai-style-preview {
    width: 82px;
    height: 56px;
    border-radius: 5px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 250, 243, 0.04);
    position: relative;
    cursor: zoom-in;
}

.pres-ai-style-preview svg {
    width: 100%;
    height: 100%;
}

.pres-ai-style-zoom-hint {
    position: absolute;
    top: 3px;
    right: 3px;
    width: 18px;
    height: 18px;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(232, 227, 219, 0.6);
    opacity: 0;
    transition: opacity 0.15s;
    pointer-events: none;
}

.pres-ai-style-preview:hover .pres-ai-style-zoom-hint {
    opacity: 1;
}

.pres-ai-style-preview-none {
    background: rgba(232, 227, 219, 0.04);
    border: 1px dashed rgba(232, 227, 219, 0.12);
}

.pres-ai-style-name {
    font-size: 0.68rem;
    color: #948e84;
    text-align: center;
    line-height: 1.2;
    max-width: 82px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.pres-ai-style-card.selected .pres-ai-style-name {
    color: #c9995e;
    font-weight: 600;
}

/* Style prompt editor */
.pres-ai-style-prompt-section {
    margin-top: 4px;
    padding: 8px;
    background: rgba(201, 153, 94, 0.04);
    border: 1px solid rgba(201, 153, 94, 0.10);
    border-radius: 6px;
}

.pres-ai-style-prompt-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 6px;
}

.pres-ai-style-prompt-header .pres-btn-icon {
    background: none;
    border: none;
    color: #948e84;
    cursor: pointer;
    padding: 2px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    transition: color 0.15s;
}

.pres-ai-style-prompt-header .pres-btn-icon:hover {
    color: #c9995e;
}

.pres-ai-style-prompt-textarea {
    width: 100%;
    background: rgba(255, 250, 243, 0.04);
    border: 1px solid rgba(232, 227, 219, 0.08);
    color: #d0cbc3;
    padding: 6px 8px;
    border-radius: 5px;
    font-size: 0.72rem;
    font-family: inherit;
    outline: none;
    resize: vertical;
    min-height: 48px;
    max-height: 120px;
    line-height: 1.4;
    box-sizing: border-box;
}

.pres-ai-style-prompt-textarea:focus {
    border-color: rgba(201, 153, 94, 0.3);
}

/* ==================== STYLE PREVIEW MODAL ==================== */
.pres-style-preview-modal {
    position: fixed;
    inset: 0;
    z-index: 10500;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s ease;
    outline: none;
}

.pres-style-preview-modal.visible {
    opacity: 1;
}

.pres-style-preview-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.65);
}

.pres-style-preview-content {
    position: relative;
    background: #2a2830;
    border: 1px solid rgba(232, 227, 219, 0.12);
    border-radius: 12px;
    padding: 16px;
    width: 420px;
    max-width: 90vw;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.6);
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.pres-style-preview-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.pres-style-preview-title {
    font-size: 0.92rem;
    font-weight: 600;
    color: #e8e3db;
}

.pres-style-preview-close {
    background: none;
    border: none;
    color: #948e84;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    transition: color 0.15s;
}

.pres-style-preview-close:hover {
    color: #e8e3db;
}

.pres-style-preview-image {
    width: 100%;
    aspect-ratio: 3 / 2;
    border-radius: 8px;
    overflow: hidden;
    background: #FDF6EC;
    display: flex;
    align-items: center;
    justify-content: center;
}

.pres-style-preview-image svg {
    width: 100%;
    height: 100%;
}

.pres-style-preview-desc {
    font-size: 0.78rem;
    color: #948e84;
    line-height: 1.4;
    text-align: center;
}

.pres-style-preview-header {
    cursor: move;
}

.pres-style-resize-handle {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 18px;
    height: 18px;
    cursor: nwse-resize;
    z-index: 2;
    display: flex;
    align-items: flex-end;
    justify-content: flex-end;
    padding: 2px;
    color: rgba(232, 227, 219, 0.2);
    transition: color 0.15s;
}

.pres-style-resize-handle:hover {
    color: rgba(201, 153, 94, 0.5);
}

.pres-ai-panel-title {
    cursor: move;
}

/* ==================== МОДАЛКА СОГЛАСОВАНИЯ СТРУКТУРЫ ==================== */
.pres-plan-approval-modal {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    z-index: 100000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.pres-plan-approval-modal.visible {
    opacity: 1;
}

.pres-plan-approval-backdrop {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.78);
}

.pres-plan-approval-content {
    position: relative;
    width: 92%;
    max-width: 860px;
    max-height: 94vh;
    background: #242229;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.5);
    display: flex;
    flex-direction: column;
    border: 1px solid rgba(232,227,219,0.10);
    overflow: hidden;
}

/* === Resize handle === */
.pres-plan-resize-handle {
    position: absolute;
    right: 0;
    bottom: 0;
    width: 18px;
    height: 18px;
    cursor: nwse-resize;
    z-index: 10;
}

.pres-plan-resize-handle::after {
    content: '';
    position: absolute;
    right: 4px;
    bottom: 4px;
    width: 8px;
    height: 8px;
    border-right: 2px solid rgba(232,227,219,0.2);
    border-bottom: 2px solid rgba(232,227,219,0.2);
}

.pres-plan-resize-handle:hover::after {
    border-color: rgba(201,153,94,0.5);
}

/* === Header === */
.pres-plan-approval-header {
    padding: 12px 20px;
    border-bottom: 1px solid rgba(232,227,219,0.07);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    cursor: move;
    user-select: none;
}

.pres-plan-header-left {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    min-width: 0;
}

.pres-plan-header-left svg {
    color: #c9995e;
    flex-shrink: 0;
}

.pres-plan-title-input {
    background: transparent;
    border: 1px solid transparent;
    border-radius: 6px;
    padding: 5px 10px;
    color: #e8e3db;
    font-size: 1rem;
    font-weight: 600;
    font-family: inherit;
    outline: none;
    flex: 1;
    min-width: 0;
    transition: border-color 0.15s, background 0.15s;
}

.pres-plan-title-input:hover {
    border-color: rgba(232,227,219,0.10);
}

.pres-plan-title-input:focus {
    border-color: rgba(201,153,94,0.4);
    background: rgba(255,250,243,0.04);
}

.pres-plan-header-nav {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.pres-plan-nav-counter {
    font-size: 0.82rem;
    color: #948e84;
    min-width: 48px;
    text-align: center;
    font-weight: 500;
    user-select: none;
}

.pres-plan-nav-prev,
.pres-plan-nav-next {
    padding: 5px 8px !important;
    min-width: 32px !important;
}

.pres-plan-nav-prev:disabled,
.pres-plan-nav-next:disabled {
    opacity: 0.3;
    cursor: not-allowed;
    pointer-events: none;
}

/* === Body === */
.pres-plan-approval-body {
    padding: 16px 20px;
    overflow-y: auto;
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.pres-plan-approval-body::-webkit-scrollbar {
    width: 5px;
}

.pres-plan-approval-body::-webkit-scrollbar-thumb {
    background: rgba(232,227,219,0.10);
    border-radius: 3px;
}

/* === Single slide view === */
.pres-plan-slide-view {
    width: 100%;
    max-width: 780px;
}

.pres-plan-slide-single {
    display: flex;
    flex-direction: column;
    gap: 10px;
    animation: pres-plan-fade-in 0.15s ease;
}

@keyframes pres-plan-fade-in {
    from { opacity: 0; transform: translateX(10px); }
    to   { opacity: 1; transform: translateX(0); }
}

/* --- Topbar --- */
.pres-plan-slide-topbar {
    display: flex;
    align-items: center;
    gap: 10px;
}

.pres-plan-slide-number {
    width: 30px;
    height: 30px;
    border-radius: 6px;
    background: rgba(201,153,94,0.15);
    color: #c9995e;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.88rem;
    font-weight: 600;
    flex-shrink: 0;
}

.pres-plan-slide-title {
    background: rgba(255,250,243,0.04);
    border: 1px solid rgba(232,227,219,0.10);
    border-radius: 6px;
    padding: 7px 12px;
    color: #e8e3db;
    font-size: 0.95rem;
    font-weight: 500;
    font-family: inherit;
    outline: none;
    flex: 1;
    min-width: 0;
    transition: border-color 0.15s;
}

.pres-plan-slide-title:focus {
    border-color: rgba(201,153,94,0.4);
}

.pres-plan-slide-delete {
    background: transparent;
    border: 1px solid rgba(232,227,219,0.08);
    border-radius: 6px;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #6b6560;
    cursor: pointer;
    transition: all 0.15s;
    flex-shrink: 0;
}

.pres-plan-slide-delete:hover:not(:disabled) {
    background: rgba(212,112,106,0.12);
    border-color: rgba(212,112,106,0.3);
    color: #d4706a;
}

.pres-plan-slide-delete:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

/* === Large preview === */
.pres-plan-slide-preview-large {
    position: relative;
    width: 100%;
    aspect-ratio: 3 / 2;
    background: rgba(255,250,243,0.025);
    border: 1px solid rgba(232,227,219,0.12);
    border-radius: 10px;
    overflow: hidden;
    cursor: default;
}

/* === Block preview === */
.pres-plan-block-preview {
    position: absolute;
    border: 1px dashed;
    border-radius: 5px;
    padding: 6px 8px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    gap: 3px;
    box-sizing: border-box;
    transition: border-color 0.15s, background 0.15s;
}

.pres-plan-block-preview:hover {
    border-style: solid;
    z-index: 2;
    filter: brightness(1.25);
}

.pres-plan-block-header {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}

.pres-plan-block-header svg {
    flex-shrink: 0;
    opacity: 0.7;
}

/* --- Edit pencil button --- */
.pres-plan-block-edit {
    margin-left: auto;
    background: transparent;
    border: none;
    padding: 2px;
    cursor: pointer;
    color: rgba(232,227,219,0.3);
    border-radius: 3px;
    line-height: 0;
    opacity: 0;
    transition: opacity 0.15s, color 0.15s, background 0.15s;
    flex-shrink: 0;
}

.pres-plan-block-preview:hover .pres-plan-block-edit {
    opacity: 1;
}

.pres-plan-block-edit:hover {
    color: #c9995e;
    background: rgba(201,153,94,0.15);
}

/* --- Inline textarea for editing --- */
.pres-plan-block-preview.editing {
    border-style: solid;
    z-index: 5;
}

.pres-plan-block-textarea {
    width: 100%;
    flex: 1;
    min-height: 0;
    background: rgba(0,0,0,0.25);
    border: 1px solid rgba(201,153,94,0.3);
    border-radius: 4px;
    color: #e8e3db;
    font-size: 0.72rem;
    font-family: inherit;
    line-height: 1.35;
    padding: 4px 6px;
    resize: none;
    outline: none;
    overflow-y: auto;
    box-sizing: border-box;
}

.pres-plan-block-textarea:focus {
    border-color: rgba(201,153,94,0.55);
}

.pres-plan-block-textarea::-webkit-scrollbar {
    width: 3px;
}

.pres-plan-block-textarea::-webkit-scrollbar-thumb {
    background: rgba(232,227,219,0.15);
    border-radius: 2px;
}

/* --- Save/Cancel buttons in edit mode --- */
.pres-plan-block-edit-actions {
    display: flex;
    gap: 2px;
    margin-left: auto;
}

.pres-plan-block-save,
.pres-plan-block-cancel-edit {
    background: transparent;
    border: none;
    padding: 2px;
    cursor: pointer;
    border-radius: 3px;
    line-height: 0;
    transition: color 0.15s, background 0.15s;
}

.pres-plan-block-save {
    color: #5db87a;
}

.pres-plan-block-save:hover {
    background: rgba(93,184,122,0.18);
}

.pres-plan-block-cancel-edit {
    color: #d4706a;
}

.pres-plan-block-cancel-edit:hover {
    background: rgba(212,112,106,0.18);
}

.pres-plan-block-role {
    font-size: 0.72rem;
    font-weight: 600;
    color: #c9995e;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.pres-plan-block-briefing {
    font-size: 0.72rem;
    color: #948e84;
    line-height: 1.3;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 5;
    line-clamp: 5;
    -webkit-box-orient: vertical;
    flex: 1;
}

/* === Controls === */
.pres-plan-card-controls {
    display: flex;
    gap: 12px;
    align-items: center;
}

.pres-plan-template-dropdown {
    background: #2a2730;
    border: 1px solid rgba(232,227,219,0.10);
    border-radius: 6px;
    padding: 6px 10px;
    color: #e8e3db;
    font-size: 0.82rem;
    font-family: inherit;
    outline: none;
    cursor: pointer;
    flex: 1;
    transition: border-color 0.15s;
    -webkit-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg width='10' height='6' viewBox='0 0 10 6' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%23948e84' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    padding-right: 28px;
}

.pres-plan-template-dropdown option {
    background: #2a2730;
    color: #e8e3db;
    padding: 6px 10px;
}

.pres-plan-template-dropdown:hover {
    border-color: rgba(232,227,219,0.18);
}

.pres-plan-template-dropdown:focus {
    border-color: rgba(201,153,94,0.4);
}

.pres-plan-slide-options {
    display: flex;
    gap: 10px;
}

.pres-plan-slide-options label {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 0.8rem;
    color: #948e84;
    cursor: pointer;
    user-select: none;
    transition: color 0.15s;
}

.pres-plan-slide-options label:hover {
    color: #c9995e;
}

.pres-plan-slide-options input[type="checkbox"] {
    margin: 0;
    cursor: pointer;
    width: 14px;
    height: 14px;
}

/* === Meta info === */
.pres-plan-card-meta {
    display: flex;
    align-items: flex-start;
    gap: 6px;
    font-size: 0.78rem;
    color: #6b6560;
    line-height: 1.4;
    padding: 0 4px;
}

.pres-plan-card-meta span {
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
}

.pres-plan-card-meta--image {
    color: rgba(93,184,122,0.8);
}

/* === Footer === */
.pres-plan-approval-footer {
    padding: 12px 20px;
    border-top: 1px solid rgba(232,227,219,0.07);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.pres-plan-footer-right {
    display: flex;
    gap: 10px;
}

.pres-plan-add-slide {
    font-size: 0.78rem !important;
}

.pres-plan-cancel {
    min-width: 100px;
}

.pres-plan-approve {
    min-width: 180px;
}
/* ==================== MINIMAP ==================== */
.pres-minimap {
    position: fixed;
    bottom: 16px;
    right: 16px;
    width: 170px;
    height: 195px;
    min-width: 120px;
    min-height: 100px;
    background: rgba(28, 26, 32, 0.95);
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
    overflow: visible;
    z-index: 10001;
    display: none; /* Скрыта по умолчанию, показывается только в режиме canvas */
}

.pres-minimap-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 10px;
    background: rgba(36, 34, 41, 0.9);
    border-bottom: 1px solid rgba(232, 227, 219, 0.07);
    cursor: move;
    user-select: none;
    border-radius: 8px 8px 0 0;
}

.pres-minimap-title {
    font-size: 0.7rem;
    color: #948e84;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.pres-minimap-zoom {
    font-size: 0.72rem;
    color: #c9995e;
    font-weight: 600;
    min-width: 36px;
    text-align: center;
}

.pres-minimap-zoom-controls {
    display: flex;
    align-items: center;
    gap: 2px;
}

.pres-minimap-zoom-btn {
    width: 20px;
    height: 20px;
    border: none;
    background: rgba(232, 227, 219, 0.08);
    color: #948e84;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 600;
    line-height: 1;
    transition: background 0.15s, color 0.15s;
}

.pres-minimap-zoom-btn:hover {
    background: rgba(201, 153, 94, 0.25);
    color: #c9995e;
}

.pres-minimap-zoom-btn.active,
.pres-hand-btn.active {
    background: rgba(201, 153, 94, 0.35);
    color: #c9995e;
}

/* Режим руки (pan) */
.pres-canvas-area.hand-mode {
    cursor: grab;
}

.pres-canvas-area.hand-mode .pres-block {
    pointer-events: none;
}

.pres-canvas-area.hand-grabbing {
    cursor: grabbing;
}

.pres-minimap-canvas {
    width: calc(100% - 20px);
    height: calc(100% - 52px);
    margin: 10px;
    background: #ffffff;
    position: relative;
    cursor: crosshair;
    border-radius: 2px;
}

.pres-minimap-resize {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 14px;
    height: 14px;
    cursor: nwse-resize;
    background: linear-gradient(135deg, transparent 50%, rgba(148, 142, 132, 0.4) 50%);
    border-radius: 0 0 8px 0;
}

.pres-minimap-resize:hover {
    background: linear-gradient(135deg, transparent 50%, rgba(201, 153, 94, 0.6) 50%);
}

.pres-minimap-viewport {
    position: absolute;
    border: 2px solid #c9995e;
    background: rgba(201, 153, 94, 0.15);
    border-radius: 2px;
    pointer-events: auto;
    cursor: move;
    box-sizing: border-box;
}

.pres-minimap-block {
    position: absolute;
    border-radius: 1px;
    pointer-events: none;
}

/* ==================== SHAPES (ФИГУРЫ) ==================== */
.pres-block[data-type="shape"] {
    background: transparent;
    border: none;
}

.pres-block[data-type="shape"] .pres-block-content {
    padding: 0;
    overflow: visible;
}

.pres-shape-svg {
    display: block;
    width: 100%;
    height: 100%;
}

.pres-block[data-type="shape"]:hover {
    outline: 2px dashed rgba(201, 153, 94, 0.5);
    outline-offset: 2px;
}

.pres-block[data-type="shape"].selected {
    outline: 2px solid #c9995e;
    outline-offset: 2px;
}

/* Node handles для редактирования узлов фигур */
.pres-shape-node-handle {
    position: absolute;
    width: 10px;
    height: 10px;
    background: #fff;
    border: 2px solid #c9995e;
    border-radius: 50%;
    z-index: 60;
    cursor: pointer;
    box-sizing: border-box;
    transform: translate(-50%, -50%);
    transition: transform 0.12s, background 0.12s;
    display: none; /* По умолчанию скрыты */
}

/* Показываем узлы только когда блок выбран */
.pres-block.selected .pres-shape-node-handle {
    display: block;
}

.pres-shape-node-handle:hover {
    transform: translate(-50%, -50%) scale(1.4);
    background: #c9995e;
}

/* Palette shape items */
.pres-shape-item svg {
    fill: none;
    stroke: currentColor;
}

.pres-shape-item:hover svg {
    stroke: #c9995e;
}

/* ========== PROPERTIES PANEL (right) ========== */
.pres-props-panel {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 240px;
    background: rgba(30, 28, 36, 0.95);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 10px;
    backdrop-filter: blur(8px);
    z-index: 100;
    display: none;
    font-size: 12px;
    color: #e8e3db;
    box-shadow: 0 4px 20px rgba(0,0,0,0.4);
}

.pres-props-panel.visible {
    display: block;
}

.pres-props-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 14px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    font-weight: 600;
    color: #c9995e;
    cursor: grab;
    user-select: none;
}

.pres-props-header.dragging {
    cursor: grabbing;
}

.pres-props-close {
    background: none;
    border: none;
    color: #948e84;
    cursor: pointer;
    font-size: 16px;
    padding: 0;
    line-height: 1;
}

.pres-props-close:hover {
    color: #e8e3db;
}

.pres-props-body {
    padding: 10px 14px 14px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: 500px;
    overflow-y: auto;
}

.pres-props-row {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.pres-props-label {
    font-size: 11px;
    color: #948e84;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.pres-props-input-row {
    display: flex;
    gap: 6px;
    align-items: center;
}

.pres-props-color-wrap {
    position: relative;
    width: 28px;
    height: 28px;
    border-radius: 4px;
    overflow: hidden;
    border: 1px solid rgba(255,255,255,0.12);
    flex-shrink: 0;
}

.pres-props-color-input {
    position: absolute;
    top: -4px;
    left: -4px;
    width: 36px;
    height: 36px;
    border: none;
    cursor: pointer;
}

.pres-props-text {
    flex: 1;
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 4px;
    padding: 6px 8px;
    font-size: 12px;
    color: #e8e3db;
    font-family: monospace;
}

.pres-props-text:focus {
    outline: none;
    border-color: #c9995e;
}

.pres-props-slider {
    flex: 1;
    height: 4px;
    -webkit-appearance: none;
    appearance: none;
    background: rgba(255,255,255,0.12);
    border-radius: 2px;
    cursor: pointer;
}

.pres-props-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 12px;
    height: 12px;
    background: #c9995e;
    border-radius: 50%;
    cursor: pointer;
}

.pres-props-number {
    width: 48px;
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 4px;
    padding: 4px 6px;
    font-size: 11px;
    color: #e8e3db;
    text-align: center;
}

.pres-props-number:focus {
    outline: none;
    border-color: #c9995e;
}

.pres-props-select {
    flex: 1;
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 4px;
    padding: 6px 8px;
    font-size: 12px;
    color: #e8e3db;
    cursor: pointer;
}

.pres-props-select:focus {
    outline: none;
    border-color: #c9995e;
}

.pres-props-select option {
    background: #1c1a20;
    color: #e8e3db;
}

.pres-props-checkbox-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.pres-props-checkbox {
    width: 16px;
    height: 16px;
    accent-color: #c9995e;
    cursor: pointer;
}

.pres-props-subrow {
    display: flex;
    gap: 6px;
    padding-left: 24px;
}

.pres-props-subrow .pres-props-label {
    width: 40px;
    flex-shrink: 0;
}

.pres-props-btn {
    background: linear-gradient(135deg, #c9995e, #a67c4a);
    border: none;
    border-radius: 6px;
    padding: 8px 12px;
    font-size: 12px;
    font-weight: 600;
    color: #1c1a20;
    cursor: pointer;
    margin-top: 6px;
    transition: transform 0.12s, box-shadow 0.12s;
}

.pres-props-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(201,153,94,0.3);
}

/* Shadow subfields hidden by default */
.pres-props-shadow-fields {
    display: none;
    flex-direction: column;
    gap: 6px;
    margin-top: 4px;
}

.pres-props-shadow-fields.visible {
    display: flex;
}

/* ==================== DRAW MODE OVERLAY ==================== */
.pres-draw-overlay {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    z-index: 1000;
    cursor: crosshair;
    display: none;
    background: rgba(201,153,94,.05);
}

.pres-draw-overlay.active {
    display: block;
}

.pres-draw-indicator {
    position: absolute;
    pointer-events: none;
    background: #6496ff;
    transform-origin: left center;
    height: 3px;
    border-radius: 2px;
    box-shadow: 0 0 8px rgba(100,150,255,.5);
}

.pres-draw-overlay .pres-draw-hint {
    position: absolute;
    top: 12px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(28,26,32,.9);
    color: #e8e3db;
    font-size: 12px;
    padding: 6px 14px;
    border-radius: 6px;
    white-space: nowrap;
    border: 1px solid rgba(232,227,219,.1);
    pointer-events: none;
}

/* ==================== ПАНЕЛЬ ИНСТРУМЕНТОВ ШАПКИ ====================
   Правка 2026-08-27. Раньше шапка не отвечала на три вопроса: в каком режиме
   я нахожусь, включена ли сетка и к чему относятся AI-кнопки. Режим показывала
   кнопка-перевёртыш с подписью текущего режима, у «Сетки» состояния не было
   вовсе, а переход на бесконечный холст молча убирал из шапки четыре элемента.
   Здесь: подпись группы, сегментированный переключатель с активным сегментом,
   выключатель с состоянием и приглушение вместо исчезновения.               */

.pres-toolbar-label {
    font-size: 0.7rem;
    color: #6b6560;
    font-weight: 500;
    white-space: nowrap;
    letter-spacing: 0.3px;
    text-transform: uppercase;
    user-select: none;
}

.pres-toolbar-sep {
    width: 1px;
    height: 20px;
    background: rgba(232,227,219,0.10);
    flex-shrink: 0;
    margin: 0 2px;
}

/* Сегментированный переключатель режима холста */
.pres-seg {
    display: flex;
    align-items: center;
    background: rgba(255,250,243,0.04);
    border: 1px solid rgba(232,227,219,0.10);
    border-radius: 6px;
    padding: 2px;
    gap: 2px;
}

.pres-seg-btn {
    background: transparent;
    border: none;
    color: #948e84;
    padding: 4px 10px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.8rem;
    font-family: inherit;
    display: flex;
    align-items: center;
    gap: 5px;
    white-space: nowrap;
    transition: background 0.15s, color 0.15s;
}

.pres-seg-btn svg {
    flex-shrink: 0;
    opacity: 0.75;
}

/* Наведение меняет фон и не сдвигает элемент */
.pres-seg-btn:hover {
    background: rgba(255,250,243,0.07);
    color: #e8e3db;
}

.pres-seg-btn.active {
    background: rgba(201,153,94,0.18);
    color: #c9995e;
    font-weight: 500;
}

.pres-seg-btn.active svg {
    opacity: 1;
}

/* Выключатель с состоянием: «Сетка» */
.pres-btn-toggle.active {
    background: rgba(201,153,94,0.15);
    border-color: rgba(201,153,94,0.30);
    color: #c9995e;
}

/* Недоступно сейчас: элемент виден и объясняет причину подсказкой,
   а по нажатию отвечает уведомлением. Исчезать ему нельзя. */
.pres-off {
    opacity: 0.38;
    filter: grayscale(0.6);
}

.pres-btn.pres-off:hover {
    background: transparent;
    border-color: rgba(232,227,219,0.10);
}

.pres-btn.primary.pres-off:hover {
    background: rgba(201,153,94,0.15);
}

.pres-ai-model-select:disabled {
    opacity: 0.45;
    cursor: default;
}

/* Приоритет сжатия: при нехватке ширины ужимается поле названия канваса,
   а не панель инструментов — иначе кнопки снова «пропадут», только уже
   обрезанием. Подписи групп («Холст», «Создать») уходят первыми: они
   декоративны, смысл несут подсветка активного сегмента и подписи кнопок. */
.pres-header-center {
    flex-shrink: 0;
}

.pres-header-left {
    min-width: 0;
}

.pres-name-input {
    min-width: 60px;
}

@media (max-width: 1280px) {
    .pres-toolbar-label { display: none; }
}

/* ==================== РЕЖИМ «СХЕМА»: ВКЛАДКИ И ПАНЕЛЬ (T1.2, T1.3) ====================
   Единственные новые классы всего ТЗ: .pres-tab-* у вкладок и .pres-schema-* у
   правой панели. Ни один существующий класс канваса здесь не переопределяется —
   вкладки берут готовый вид сегментированного переключателя (.pres-seg/.pres-seg-btn
   из T1.0), ползунок глубины — готовый .pres-props-slider панели свойств.
   Палитра — та же, что у соседних панелей канваса (#242229 / #948e84 / #c9995e):
   модуль тёмный, и новая колонка обязана читаться как его часть.
   Общий гид по стилю — Docs/PERPLEXITY_STYLE_GUIDE.md. */

/* Вкладки в шапке: тот же сегмент, что «Холст», без третьего вида переключателя */
.pres-tab-seg {
    flex-shrink: 0;
}

.pres-tab-btn {
    font-weight: 500;
}

/* Правая колонка рабочей области — соседка холста, а не слой поверх него */
.pres-schema-panel {
    width: 360px;
    min-width: 360px;
    flex-shrink: 0;
    background: #242229;
    border-left: 1px solid rgba(232,227,219,0.07);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-height: 0;
    font-family: inherit;
}

.pres-schema-head {
    padding: 12px 14px 10px;
    border-bottom: 1px solid rgba(232,227,219,0.07);
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.pres-schema-title {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 0.9rem;
    color: #e8e3db;
}

.pres-schema-title svg {
    flex-shrink: 0;
    color: #c9995e;
}

.pres-schema-sub {
    font-size: 0.75rem;
    line-height: 1.4;
    color: #948e84;
}

.pres-schema-section {
    padding: 10px 14px 0;
    display: flex;
    flex-direction: column;
    gap: 7px;
}

.pres-schema-section-label {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #948e84;
}

/* Кнопки предмета схемы — закрытый набор из четырёх, вид по образцу
   переключателя режимов AI-Аналитика: значок 14×14 + подпись, активная
   выделена классом, наведение меняет фон и не сдвигает элемент */
.pres-schema-subjects {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.pres-schema-subject-btn {
    flex: 1 1 calc(50% - 6px);
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 5px;
    padding: 7px 10px;
    background: rgba(255,250,243,0.04);
    border: 1px solid rgba(232,227,219,0.07);
    border-radius: 6px;
    color: #948e84;
    font-family: inherit;
    font-size: 0.78rem;
    cursor: pointer;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.pres-schema-subject-btn svg {
    flex-shrink: 0;
    opacity: 0.75;
}

.pres-schema-subject-btn:hover {
    background: rgba(255,250,243,0.07);
    color: #e8e3db;
}

.pres-schema-subject-btn.active {
    background: rgba(201,153,94,0.18);
    border-color: rgba(201,153,94,0.30);
    color: #c9995e;
    font-weight: 500;
}

.pres-schema-subject-btn.active svg {
    opacity: 1;
}

.pres-schema-depth-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 8px;
}

.pres-schema-depth-value {
    font-size: 0.78rem;
    color: #c9995e;
}

/* Вид дорожки и бегунка наследуется от .pres-props-slider — обе метки стоят
   на элементе, здесь только ширина на всю колонку */
.pres-schema-slider {
    width: 100%;
}

.pres-schema-build-btn {
    margin: 12px 14px 10px;
    justify-content: center;
}

/* Лента сообщений над полем ввода */
.pres-schema-chat-messages {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 12px 14px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    border-top: 1px solid rgba(232,227,219,0.07);
}

.pres-schema-chat-messages::-webkit-scrollbar {
    width: 5px;
}

.pres-schema-chat-messages::-webkit-scrollbar-thumb {
    background: rgba(232,227,219,0.12);
    border-radius: 3px;
}

.pres-schema-chat-messages::-webkit-scrollbar-thumb:hover {
    background: rgba(232,227,219,0.22);
}

.pres-schema-chat-welcome {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 36px 12px;
    text-align: center;
    color: #948e84;
}

.pres-schema-chat-welcome svg {
    width: 38px;
    height: 38px;
    opacity: 0.3;
}

.pres-schema-chat-welcome p {
    margin: 0;
    font-size: 0.78rem;
    line-height: 1.5;
    max-width: 280px;
}

.pres-schema-chat-msg {
    display: flex;
    max-width: 90%;
}

.pres-schema-chat-msg-user {
    align-self: flex-end;
}

.pres-schema-chat-msg-assistant {
    align-self: flex-start;
}

.pres-schema-chat-bubble {
    padding: 8px 11px;
    border-radius: 10px;
    font-size: 0.79rem;
    line-height: 1.5;
    white-space: normal;
    word-break: break-word;
}

.pres-schema-chat-msg-user .pres-schema-chat-bubble {
    background: rgba(201,153,94,0.16);
    color: #e8e3db;
}

.pres-schema-chat-msg-assistant .pres-schema-chat-bubble {
    background: rgba(255,250,243,0.05);
    color: #cfc9c0;
}

/* Поле ввода: однострочный автораскрывающийся textarea + круглая кнопка справа */
.pres-schema-chat-input-area {
    padding: 10px 14px 12px;
    border-top: 1px solid rgba(232,227,219,0.07);
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.pres-schema-chat-input-row {
    display: flex;
    align-items: flex-end;
    gap: 8px;
}

.pres-schema-chat-input {
    flex: 1;
    min-height: 54px;   /* две строки: пол держится и здесь, и в CHAT_INPUT_MIN_H */
    max-height: 120px;
    resize: none;
    background: rgba(255,250,243,0.04);
    border: 1px solid rgba(232,227,219,0.10);
    border-radius: 10px;
    padding: 8px 11px;
    color: #e8e3db;
    font-family: inherit;
    font-size: 0.79rem;
    line-height: 1.4;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.pres-schema-chat-input::placeholder {
    color: #6f6a63;
}

.pres-schema-chat-input:focus {
    outline: none;
    border-color: rgba(201,153,94,0.45);
    box-shadow: 0 0 0 3px rgba(201,153,94,0.15);
}

.pres-schema-chat-send-btn {
    flex-shrink: 0;
    width: 34px;
    height: 34px;
    border: none;
    border-radius: 50%;
    background: rgba(201,153,94,0.18);
    color: #c9995e;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s, color 0.15s, transform 0.15s;
}

.pres-schema-chat-send-btn:hover {
    background: rgba(201,153,94,0.30);
}

.pres-schema-chat-send-btn:active {
    transform: scale(0.96);
}

.pres-schema-chat-hint {
    font-size: 0.7rem;
    line-height: 1.4;
    color: #6f6a63;
}

/* Узкий экран: панель не должна съедать холст целиком */
@media (max-width: 1440px) {
    .pres-schema-panel {
        width: 320px;
        min-width: 320px;
    }
}

/* ==================== ИНДИКАТОР РАБОТЫ АССИСТЕНТА (T1.6) ====================
   Виден с любой вкладки и в любом режиме: спиннеры внутри диалога и панели
   блока пропадали из виду, стоило уйти с них, и понять, работает ассистент
   или уже закончил, было нельзя. Общий гид — Docs/PERPLEXITY_STYLE_GUIDE.md. */

.pres-busy {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    height: 26px;
    padding: 0 12px;
    margin-right: 4px;
    background: rgba(201,153,94,0.15);
    border-radius: 9999px;
    color: #c9995e;
    font-size: 0.78rem;
    white-space: nowrap;
    max-width: 260px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.pres-busy-dot {
    width: 7px;
    height: 7px;
    flex-shrink: 0;
    border-radius: 50%;
    background: #c9995e;
    animation: pres-busy-pulse 1.2s ease-in-out infinite;
}

@keyframes pres-busy-pulse {
    0%, 100% { opacity: 0.35; transform: scale(0.8); }
    50%      { opacity: 1;    transform: scale(1); }
}

.pres-busy-text {
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Узкая шапка: остаётся точка — она и отвечает на вопрос «идёт или нет» */
@media (max-width: 1280px) {
    .pres-busy-text { display: none; }
    .pres-busy { padding: 0 8px; }
}

/* ==================== РАЗБОР И ОТКАЗ В ПАНЕЛИ «СХЕМА» (волна 3) ====================
   Отчёт о разборе и сообщение об отказе живут в той же ленте, что и остальные
   реплики: своих контейнеров и своей ленты режим не заводит. Новые классы —
   только .pres-schema-*, ни один существующий не переопределяется. */

.pres-schema-build-btn:disabled {
    opacity: 0.55;
    cursor: default;
}

/* Пока идёт разбор, та же кнопка отменяет его — вид меняется на «стоп» */
.pres-schema-build-btn.is-cancel {
    background: rgba(232,227,219,0.08);
    border: 1px solid rgba(232,227,219,0.18);
    color: #cfc9c0;
}

.pres-schema-build-btn.is-cancel:hover {
    background: rgba(232,227,219,0.14);
}

/* Строка стадии: живёт внизу ленты, пока идёт разбор */
.pres-schema-status {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 2px;
    font-size: 0.76rem;
    color: #948e84;
}

.pres-schema-status-dot {
    width: 6px;
    height: 6px;
    flex-shrink: 0;
    border-radius: 50%;
    background: #c9995e;
    animation: pres-busy-pulse 1.2s ease-in-out infinite;
}

/* Отчёт о разборе */
.pres-schema-chat-bubble-report,
.pres-schema-chat-bubble-refusal {
    max-width: 100%;
}

.pres-schema-report-line {
    margin-bottom: 6px;
}

.pres-schema-report-line b {
    color: #e8e3db;
    font-weight: 600;
}

.pres-schema-cands {
    margin: 4px 0 8px;
    padding-left: 18px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.pres-schema-cands li {
    line-height: 1.45;
}

.pres-schema-cand-name {
    display: block;
    color: #e8e3db;
    font-weight: 600;
}

.pres-schema-cand-meta {
    display: block;
    font-size: 0.72rem;
    color: #948e84;
}

.pres-schema-cand-why {
    display: block;
    font-size: 0.74rem;
    color: #a8a29a;
    font-style: italic;
}

.pres-schema-rejected,
.pres-schema-report-note {
    margin-top: 6px;
    font-size: 0.73rem;
    color: #6f6a63;
    line-height: 1.45;
}

/* Отказ: три части — что не сложилось, почему, что можно вместо */
.pres-schema-chat-bubble-refusal {
    border-left: 2px solid rgba(201,153,94,0.55);
}

.pres-schema-refusal-what {
    color: #e8e3db;
    font-weight: 600;
    margin-bottom: 5px;
}

.pres-schema-refusal-why {
    margin-bottom: 6px;
}

.pres-schema-refusal-instead ul {
    margin: 4px 0 0;
    padding-left: 18px;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

/* Предложение проиндексировать ветку («Анализ проекта»).
   Форма та же, что у отказа: сначала что случилось, потом почему, потом
   действие — и цена действия названа до нажатия, а не после. */
.pres-schema-chat-bubble-index {
    max-width: 100%;
    border-left: 2px solid rgba(148,142,132,0.5);
}

.pres-schema-index-what {
    color: #e8e3db;
    font-weight: 600;
    margin-bottom: 5px;
}

.pres-schema-index-why {
    margin-bottom: 8px;
}

.pres-schema-index-btn {
    width: 100%;
    padding: 7px 10px;
    border: 1px solid rgba(201,153,94,0.45);
    border-radius: 8px;
    background: rgba(201,153,94,0.16);
    color: #e8e3db;
    font-family: inherit;
    font-size: 0.78rem;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
}

.pres-schema-index-btn:hover:not(:disabled) {
    background: rgba(201,153,94,0.28);
}

.pres-schema-index-btn:disabled {
    opacity: 0.55;
    cursor: default;
}

.pres-schema-index-cost,
.pres-schema-index-note {
    margin-top: 6px;
    font-size: 0.72rem;
    line-height: 1.45;
    color: #6f6a63;
}

/* ==================== ПОСТРОЕННАЯ СХЕМА В ПАНЕЛИ (волна 4, T2.3–T2.5) ====================
   Сама схема — обычный слайд существующего редактора, своих стилей у её блоков
   нет и не должно быть. Здесь только то, что живёт в правой панели: кнопки на
   остальные разрезы и погашенный ползунок глубины. */

.pres-schema-chips-label {
    margin-top: 8px;
    font-size: 0.72rem;
    color: #6f6a63;
    line-height: 1.45;
}

.pres-schema-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 6px;
}

.pres-schema-chip {
    padding: 5px 9px;
    border: 1px solid rgba(232,227,219,0.18);
    border-radius: 12px;
    background: rgba(232,227,219,0.06);
    color: #cfc9c0;
    font-family: inherit;
    font-size: 0.72rem;
    line-height: 1.3;
    text-align: left;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.pres-schema-chip:hover {
    background: rgba(201,153,94,0.18);
    border-color: rgba(201,153,94,0.45);
    color: #e8e3db;
}

/* Ползунок гаснет, когда схему правили руками: свёртка затёрла бы правку */
.pres-schema-slider:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.pres-schema-depth-value.is-locked {
    color: #6f6a63;
    text-decoration: line-through;
}