.dxfe-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(9, 11, 18, 0.58);
    z-index: 1000;
}

.dxfe-modal {
    position: fixed;
    inset: 10vh 10vw;
    width: 80vw;
    height: 80vh;
    border-radius: 14px;
    border: 1px solid rgba(148, 163, 184, 0.3);
    background: #0f172a;
    color: #e2e8f0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    z-index: 1010;
    box-shadow: 0 24px 52px rgba(2, 6, 23, 0.6);
}

.dxfe-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid rgba(148, 163, 184, 0.2);
}

.dxfe-title {
    margin: 0;
    font-size: 1rem;
    font-weight: 700;
}

.dxfe-subtitle {
    margin: 0.125rem 0 0;
    font-size: 0.82rem;
    color: #94a3b8;
}

.dxfe-found {
    margin: 0.25rem 0 0;
    font-size: 0.78rem;
    color: #fbbf24;
}

.dxfe-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    border-radius: 0.5rem;
    color: #cbd5e1;
    border: 1px solid rgba(148, 163, 184, 0.25);
    background: transparent;
}

.dxfe-body {
    flex: 1;
    min-height: 0;
    display: grid;
    grid-template-columns: 320px minmax(0, 1fr);
}

.dxfe-sidebar {
    border-right: 1px solid rgba(148, 163, 184, 0.2);
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.dxfe-sidebar-top {
    padding: 0.75rem;
    display: flex;
    gap: 0.5rem;
    border-bottom: 1px solid rgba(148, 163, 184, 0.15);
}

.dxfe-chip {
    border: 1px solid rgba(148, 163, 184, 0.35);
    background: rgba(15, 23, 42, 0.6);
    color: #cbd5e1;
    border-radius: 999px;
    padding: 0.28rem 0.62rem;
    font-size: 0.74rem;
    line-height: 1.2;
}

.dxfe-chip-active {
    border-color: rgba(59, 130, 246, 0.8);
    color: #dbeafe;
    background: rgba(30, 64, 175, 0.35);
}

.dxfe-chip:disabled {
    opacity: 0.45;
    cursor: default;
}

.dxfe-chip-danger.dxfe-chip-active {
    border-color: rgba(248, 113, 113, 0.85);
    color: #fee2e2;
    background: rgba(153, 27, 27, 0.4);
}

.dxfe-chip-keep.dxfe-chip-active {
    border-color: rgba(52, 211, 153, 0.85);
    color: #d1fae5;
    background: rgba(6, 95, 70, 0.4);
}

.dxfe-modes {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

.dxfe-switch {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}

.dxfe-switch input {
    margin: 0;
}

.dxfe-placeholder {
    color: #94a3b8;
    font-size: 0.8rem;
    padding: 1rem;
}

.dxfe-sidebar-scroll {
    overflow: auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

.dxfe-group-list {
    padding: 0.65rem 0.7rem 1rem;
}

.dxfe-section + .dxfe-section {
    margin-top: 0.9rem;
}

.dxfe-section-title {
    margin: 0 0 0.45rem;
    color: #94a3b8;
    font-size: 0.72rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.dxfe-group-row {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto auto;
    align-items: center;
    gap: 0.55rem;
    border-radius: 0.55rem;
    padding: 0.42rem 0.44rem;
    cursor: pointer;
}

.dxfe-group-row:hover {
    background: rgba(30, 41, 59, 0.65);
}

.dxfe-checkbox {
    margin: 0;
}

.dxfe-group-main {
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.dxfe-group-name {
    font-size: 0.78rem;
    color: #e2e8f0;
}

.dxfe-group-meta {
    margin-top: 0.07rem;
    color: #94a3b8;
    font-size: 0.69rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dxfe-group-stats {
    font-size: 0.68rem;
    color: #cbd5e1;
    white-space: nowrap;
}

.dxfe-eye {
    border: 0;
    background: transparent;
    color: #94a3b8;
    width: 1.4rem;
    height: 1.4rem;
    padding: 0.15rem;
}

.dxfe-canvas-wrap {
    position: relative;
    min-width: 0;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

.dxfe-canvas-toolbar {
    padding: 0.65rem 0.75rem;
    border-bottom: 1px solid rgba(148, 163, 184, 0.15);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.dxfe-hint {
    margin-left: auto;
    color: #64748b;
    font-size: 0.7rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dxfe-canvas {
    flex: 1;
    min-height: 0;
    background: #f8fafc;
    cursor: grab;
}

.dxfe-canvas:active {
    cursor: grabbing;
}

.dxfe-canvas.is-placing,
.dxfe-canvas.is-placing:active,
.dxfe-canvas.is-marquee,
.dxfe-canvas.is-marquee:active {
    cursor: crosshair;
}

/* Výberový obdĺžnik: absolútne v .dxfe-canvas-wrap, súradnice počíta JS. */
.dxfe-marquee {
    position: absolute;
    z-index: 5;
    pointer-events: none;
    border: 1px dashed rgba(248, 113, 113, 0.95);
    background: rgba(248, 113, 113, 0.14);
}

.dxfe-marquee-keep {
    border-color: rgba(52, 211, 153, 0.95);
    background: rgba(52, 211, 153, 0.14);
}

.dxfe-svg {
    width: 100%;
    height: 100%;
    display: block;
}

.dxfe-path {
    fill: none;
    stroke: #0f172a;
    stroke-width: 1.05;
    pointer-events: none;
}

.dxfe-path.is-deleted {
    stroke: #a8b3c5;
    opacity: 0.45;
}

.dxfe-path.is-hovered {
    stroke: #dc2626;
    stroke-width: 1.5;
    opacity: 1;
}

.dxfe-path.is-muted {
    opacity: 0.16;
}

.dxfe-hit {
    fill: none;
    stroke: transparent;
    stroke-width: 8;
    pointer-events: stroke;
    cursor: pointer;
}

.dxfe-text {
    fill: #0f172a;
    stroke: none;
    font-family: ui-monospace, 'Cascadia Mono', 'Segoe UI Mono', monospace;
    pointer-events: all;
    cursor: pointer;
}

.dxfe-text.is-deleted {
    fill: #a8b3c5;
    opacity: 0.45;
}

.dxfe-text.is-hovered {
    fill: #dc2626;
    opacity: 1;
}

.dxfe-text.is-muted {
    opacity: 0.16;
}

.dxfe-engrave-text {
    fill: #16a34a;
    stroke: none;
    font-family: ui-monospace, 'Cascadia Mono', 'Segoe UI Mono', monospace;
    cursor: pointer;
}

.dxfe-engrave-text:hover {
    fill: #dc2626;
}

.dxfe-engrave {
    border-top: 1px solid rgba(148, 163, 184, 0.15);
    padding: 0.65rem 0.7rem 0.9rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-top: auto;
}

.dxfe-engrave-source {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.dxfe-radio {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.76rem;
    color: #cbd5e1;
    cursor: pointer;
}

.dxfe-radio input {
    margin: 0;
}

.dxfe-input {
    border: 1px solid rgba(148, 163, 184, 0.35);
    background: rgba(15, 23, 42, 0.6);
    color: #e2e8f0;
    border-radius: 0.45rem;
    padding: 0.32rem 0.5rem;
    font-size: 0.78rem;
    width: 100%;
}

.dxfe-input-num {
    width: 4.2rem;
    text-align: right;
}

.dxfe-engrave-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}

.dxfe-engrave-size {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.74rem;
    color: #cbd5e1;
}

.dxfe-engrave-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    background: rgba(22, 101, 52, 0.25);
    border: 1px solid rgba(34, 197, 94, 0.35);
    border-radius: 0.45rem;
    padding: 0.3rem 0.5rem;
    font-size: 0.74rem;
    color: #bbf7d0;
}

.dxfe-engrave-item-text {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dxfe-engrave-remove {
    border: 0;
    background: transparent;
    color: #86efac;
    font-size: 0.95rem;
    line-height: 1;
    padding: 0 0.15rem;
    cursor: pointer;
}

.dxfe-engrave-remove:hover {
    color: #fca5a5;
}

.dxfe-footer {
    border-top: 1px solid rgba(148, 163, 184, 0.2);
    padding: 0.65rem 0.85rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.dxfe-summary {
    color: #cbd5e1;
    font-size: 0.78rem;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dxfe-error {
    flex: 1;
    min-width: 0;
    color: #fca5a5;
    font-size: 0.78rem;
    text-align: right;
}

.dxfe-actions {
    display: flex;
    align-items: center;
    gap: 0.55rem;
}

.dxfe-btn {
    border: 1px solid rgba(148, 163, 184, 0.35);
    background: transparent;
    color: #e2e8f0;
    border-radius: 0.5rem;
    padding: 0.4rem 0.68rem;
    font-size: 0.78rem;
}

.dxfe-btn-primary {
    border-color: rgba(37, 99, 235, 0.75);
    background: rgba(37, 99, 235, 0.35);
    color: #dbeafe;
}

.dxfe-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.dxfe-enter {
    transition: transform 150ms ease, opacity 150ms ease;
}

.dxfe-enter-start {
    transform: translateY(8px) scale(0.985);
    opacity: 0;
}

.dxfe-enter-end {
    transform: translateY(0) scale(1);
    opacity: 1;
}

.dxfe-leave {
    transition: transform 100ms ease, opacity 100ms ease;
}

@media (max-width: 900px) {
    .dxfe-modal {
        inset: 2vh 2vw;
        width: 96vw;
        height: 96vh;
    }

    .dxfe-body {
        grid-template-columns: minmax(0, 1fr);
        grid-template-rows: minmax(220px, 42%) minmax(0, 1fr);
    }

    .dxfe-sidebar {
        border-right: 0;
        border-bottom: 1px solid rgba(148, 163, 184, 0.2);
    }

    .dxfe-canvas-toolbar {
        flex-wrap: wrap;
    }

    .dxfe-hint {
        width: 100%;
        margin-left: 0;
    }
}

@media (max-width: 640px) {
    .dxfe-modal {
        inset: 0;
        width: 100vw;
        height: 100dvh;
        border: 0;
        border-radius: 0;
    }

    .dxfe-body {
        grid-template-rows: minmax(210px, 44%) minmax(0, 1fr);
    }

    .dxfe-hint {
        display: none;
    }

    .dxfe-footer {
        align-items: stretch;
        flex-direction: column;
        gap: 0.5rem;
    }

    .dxfe-actions {
        justify-content: flex-end;
    }
}
