body {
    font-family: 'Segoe UI', sans-serif;
    .dd-ctx-menu background: #f0f2f7
}

.wrap {
    max-width: none;
    margin: 30px 16px;
    padding: 0
}

h2 {
    color: #1a2340;
    font-size: 1.4rem;
    margin-bottom: 6px
}

.subtitle {
    color: #6b7a99;
    font-size: .85rem;
    margin-bottom: 22px
}

.card {
    background: white;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0,0,0,.07);
    padding: 20px;
    margin-bottom: 14px
}

    .card h3 {
        font-size: .9rem;
        font-weight: 600;
        color: #1a2340;
        margin: 0 0 12px;
        border-left: 3px solid #EF7F1A;
        padding-left: 10px;
        display: flex;
        align-items: center;
        gap: 8px;
        flex-wrap: wrap
    }

.btn {
    padding: 7px 14px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: .82rem;
    font-weight: 600;
    transition: all .15s
}

.btn-primary {
    background: #EF7F1A;
    color: white
}

    .btn-primary:hover {
        background: #c8650e
    }

.btn-secondary {
    background: #fff5ec;
    color: #EF7F1A;
    border: 1px solid #fcd9b0
}

    .btn-secondary:hover {
        background: #fdebd6
    }

.btn-danger {
    background: #fee;
    color: #c0392b;
    border: 1px solid #fcc
}

    .btn-danger:hover {
        background: #fdd
    }

input, textarea, select {
    padding: 5px 8px;
    border: 1px solid #dde2ef;
    border-radius: 5px;
    font-size: .81rem;
    color: #1a2340;
    background: #fafbff;
    box-sizing: border-box;
    width: 100%
}

    input:focus, textarea:focus, select:focus {
        outline: none;
        border-color: #EF7F1A
    }

textarea {
    resize: vertical
}

.msg-ok {
    color: #27ae60;
    font-size: .85rem;
    margin-top: 8px
}

.msg-err {
    color: #e74c3c;
    font-size: .85rem;
    margin-top: 8px
}

.preview-obj {
    position: absolute;
    display: flex;
    align-items: center;
    overflow: hidden;
    padding: 0 3px;
    box-sizing: border-box;
    pointer-events: none
}

.preview-obj-text {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    width: 100%
}

.vis-btn {
    padding: 2px 7px;
    border-radius: 4px;
    border: 1px solid #dde2ef;
    font-size: .72rem;
    cursor: pointer;
    font-weight: 600;
    background: #f8f9ff;
    color: #6b7a99
}

    .vis-btn.visible {
        background: #eafaf1;
        color: #1e8449;
        border-color: #a9dfbf
    }

    .vis-btn.hidden {
        background: #f9f0f0;
        color: #c0392b;
        border-color: #f5c6c6
    }

.hf-obj-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px
}

.hf-obj-card {
    background: #fafbff;
    border: 1px solid #e0e6f5;
    border-radius: 7px;
    padding: 10px 12px;
    min-width: 180px;
    display: flex;
    flex-direction: column;
    gap: 5px
}

    .hf-obj-card.hidden-card {
        opacity: .45
    }

.hf-obj-name {
    font-size: .78rem;
    font-weight: 700;
    color: #1a2340;
    display: flex;
    align-items: center;
    gap: 5px
}

.hf-obj-inputs {
    display: flex;
    flex-direction: column;
    gap: 4px
}

.hf-obj-row {
    display: flex;
    align-items: center;
    gap: 5px
}

.hf-obj-lbl {
    font-size: .66rem;
    color: #6b7a99;
    white-space: nowrap;
    width: 40px
}

.hf-obj-inp {
    flex: 1;
    padding: 3px 6px;
    font-size: .8rem;
    border: 1px solid #dde2ef;
    border-radius: 4px
}

.color-swatch {
    width: 22px;
    height: 22px;
    padding: 1px;
    border: 1px solid #dde2ef;
    border-radius: 3px;
    cursor: pointer
}

.tipo-mini {
    font-size: .58rem;
    font-weight: 700;
    border-radius: 3px;
    padding: 1px 4px;
    vertical-align: middle;
    margin-left: 3px
}

.cf-chip {
    display: flex;
    flex-direction: column;
    gap: 4px;
    background: #fff8f2;
    border: 1px solid #fcd9b0;
    border-radius: 6px;
    padding: 7px 10px;
    font-size: .74rem
}

.cf-chip-title {
    font-weight: 700;
    color: #EF7F1A
}

.cf-chip-meta {
    font-size: .68rem;
    color: #6b7a99;
    font-style: italic
}

.cf-chip-mask {
    font-size: .68rem;
    color: #888;
    font-family: 'Consolas', monospace
}

.cf-value {
    font-weight: 700;
    color: #1e8449;
    font-size: .76rem;
    font-family: 'Consolas', monospace
}

.tree-container {
    border: 1px solid #dde2ef;
    border-radius: 8px;
    padding: 10px;
    background: #fafbff;
    margin-bottom: 10px
}

.tree-group {
    border: 1px solid #c8b8f5;
    border-radius: 7px;
    background: #f9f6ff;
    margin-bottom: 6px
}

.tree-group-header {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 7px 10px;
    cursor: pointer;
    user-select: none
}

.tree-group-body {
    padding: 4px 10px 8px 18px;
    display: flex;
    flex-direction: column;
    gap: 4px
}

.tree-linha {
    display: flex;
    align-items: center;
    gap: 6px;
    background: #fff;
    border: 1px solid #e0e6f5;
    border-radius: 5px;
    padding: 5px 9px
}

.tree-btn {
    padding: 2px 8px;
    border-radius: 4px;
    border: 1px solid #c8b8f5;
    font-size: .72rem;
    font-weight: 600;
    cursor: pointer;
    background: #ede9fe;
    color: #5b21b6;
    white-space: nowrap
}

    .tree-btn:hover {
        background: #5b21b6;
        color: white
    }

.tree-btn-danger {
    border-color: #fcc;
    background: #fee;
    color: #c0392b
}

    .tree-btn-danger:hover {
        background: #c0392b;
        color: white;
        border-color: #c0392b
    }

.tree-btn-line {
    background: #f0fff4;
    color: #1e8449;
    border-color: #a9dfbf
}

    .tree-btn-line:hover {
        background: #1e8449;
        color: white;
        border-color: #1e8449
    }

.tree-btn-disabled, .tree-btn-disabled:hover {
    background: #f0f0f0 !important;
    color: #b0b0b0 !important;
    border-color: #d8d8d8 !important;
    cursor: not-allowed !important;
    pointer-events: none
}

.tree-separador {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 3px 8px;
    margin: 4px 0 2px;
    background: #e8ecff;
    border-left: 3px solid #5b21b6;
    border-radius: 4px;
    font-size: .72rem;
    font-weight: 700;
    color: #1a2340;
    user-select: none
}

.tree-separador-label {
    flex: 1;
    letter-spacing: .02em
}

.tree-separador-count {
    font-size: .65rem;
    color: #6b7a99;
    font-weight: 400
}

.db-filter-wrap {
    padding: 8px 12px 10px;
    border-top: 1px solid #e0e6f5;
    background: #f7f8ff;
    border-radius: 0 0 7px 7px
}

.dd-canvas-scroll-wrap {
    overflow-x: auto
}

#dd-canvas-zoom-wrap {
    display: block
}

.db-filter-title {
    font-size: .67rem;
    font-weight: 700;
    color: #1a2340;
    text-transform: uppercase;
    letter-spacing: .04em;
    margin-bottom: 6px
}

.db-campo-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-bottom: 8px
}

.db-campo-btn {
    padding: 2px 9px;
    border-radius: 4px;
    border: 1px solid #c0cce8;
    font-size: .72rem;
    font-weight: 600;
    cursor: pointer;
    background: #eef0fa;
    color: #1a2340;
    white-space: nowrap;
    transition: all .12s
}

    .db-campo-btn.ativo {
        background: #1a2340;
        color: white;
        border-color: #1a2340
    }

    .db-campo-btn:hover:not(.ativo) {
        background: #dde2ef
    }

.db-result-count {
    font-size: .72rem;
    color: #1e8449;
    font-weight: 700;
    background: #eafaf1;
    border: 1px solid #a9dfbf;
    border-radius: 4px;
    padding: 2px 8px;
    display: inline-block
}

.nivel-footer-wrap {
    border: 1px solid #c8b8f5;
    border-radius: 7px;
    background: #f4f0ff;
    padding: 10px 14px;
    margin-top: 10px
}

.nivel-footer-title {
    font-size: .72rem;
    font-weight: 700;
    color: #5b21b6;
    text-transform: uppercase;
    letter-spacing: .04em;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 8px
}

.nivel-footer-item {
    background: white;
    border: 1px solid #dde2ef;
    border-radius: 6px;
    padding: 8px 12px;
    margin-bottom: 10px
}

.nivel-footer-item-hdr {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
    flex-wrap: wrap
}

.nivel-badge {
    font-size: .68rem;
    font-weight: 700;
    background: #5b21b6;
    color: white;
    border-radius: 4px;
    padding: 2px 7px
}

.nivel-campo-label {
    font-size: .68rem;
    color: #6b7a99;
    font-style: italic;
    flex: 1
}

.nivel-canvas-wrap {
    overflow: visible;
    margin: 0;
    padding: 0;
    display: block;
    line-height: 0;
    font-size: 0
}

.nivel-canvas-ruler {
    height: 16px;
    background: #e8ecf5;
    border-bottom: 1px solid #aab0c0;
    position: relative;
    display: flex;
    align-items: center;
    padding: 0 6px 0 8px;
    font-size: .62rem;
    font-weight: 700;
    color: #5b21b6;
    letter-spacing: .03em;
    width: 756px;
    box-sizing: border-box;
    gap: 3px;
    overflow: hidden
}

.nivel-canvas-inner {
    position: relative;
    background: white;
    cursor: crosshair;
    background-image: repeating-linear-gradient(90deg,transparent,transparent 19px,#f0f0f8 19px,#f0f0f8 20px), repeating-linear-gradient(0deg,transparent,transparent 19px,#f0f0f8 19px,#f0f0f8 20px);
    box-shadow: 0 2px 14px rgba(0,0,0,.28), 0 0 0 1px rgba(0,0,0,.08), inset 3px 0 0 #EF7F1A, inset -3px 0 0 #EF7F1A
}

    .nivel-canvas-inner::after {
        content: var(--canvas-w-label);
        position: absolute;
        bottom: 6px;
        right: 6px;
        font-size: .52rem;
        color: #EF7F1A;
        font-weight: 700;
        pointer-events: none;
        opacity: .55;
        letter-spacing: .03em
    }

.nivel-dd-obj {
    position: absolute;
    border: 1px dashed #aab;
    border-radius: 0;
    display: flex;
    align-items: flex-start;
    overflow: hidden;
    flex-wrap: wrap;
    cursor: grab;
    user-select: none;
    box-sizing: border-box;
    padding: 1px 4px;
    min-height: fit-content
}

    .nivel-dd-obj:hover {
        border-color: #EF7F1A;
        border-style: dashed
    }

    .nivel-dd-obj.sel {
        border: 1.5px dashed #EF7F1A !important;
        cursor: move
    }

.nivel-dd-obj-text {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    width: 100%;
    pointer-events: none;
    line-height: 1.2
}

.nivel-resize-handle {
    position: absolute;
    width: 8px;
    height: 8px;
    background: #EF7F1A;
    border: 1px solid white;
    border-radius: 0;
    z-index: 10;
    box-sizing: border-box
}

.nrh-nw {
    top: -4px;
    left: -4px;
    cursor: nw-resize
}

.nrh-n {
    top: -4px;
    left: calc(50% - 4px);
    cursor: n-resize
}

.nrh-ne {
    top: -4px;
    right: -4px;
    cursor: ne-resize
}

.nrh-e {
    top: calc(50% - 4px);
    right: -4px;
    cursor: e-resize
}

.nrh-se {
    bottom: -4px;
    right: -4px;
    cursor: se-resize
}

.nrh-s {
    bottom: -4px;
    left: calc(50% - 4px);
    cursor: s-resize
}

.nrh-sw {
    bottom: -4px;
    left: -4px;
    cursor: sw-resize
}

.nrh-w {
    top: calc(50% - 4px);
    left: -4px;
    cursor: w-resize
}

.nivel-props-panel {
    border: 1px solid #dde2ef;
    border-radius: 6px;
    padding: 10px;
    background: #fafbff;
    font-size: .78rem
}

.nivel-campo-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-bottom: 8px
}

.nivel-campo-chip {
    padding: 2px 8px;
    border-radius: 4px;
    border: 1px solid #fcd9b0;
    font-size: .72rem;
    font-weight: 600;
    cursor: pointer;
    background: #fff5ec;
    color: #EF7F1A;
    white-space: nowrap;
    transition: all .12s
}

    .nivel-campo-chip:hover {
        background: #EF7F1A;
        color: white;
        border-color: #EF7F1A
    }

.add-campo-popup-wrap {
    position: relative;
    display: inline-flex;
    align-items: center
}

.add-campo-popup {
    position: fixed;
    z-index: 10000;
    background: white;
    border: 1px solid #dde2ef;
    border-radius: 8px;
    box-shadow: 0 4px 18px rgba(0,0,0,.14);
    padding: 8px;
    width: 240px;
    display: flex;
    flex-direction: column;
    gap: 6px
}

.add-campo-popup-search {
    width: 100%;
    padding: 5px 8px;
    border: 1px solid #dde2ef;
    border-radius: 5px;
    font-size: .78rem;
    outline: none;
    box-sizing: border-box
}

    .add-campo-popup-search:focus {
        border-color: #5b21b6
    }

.add-campo-popup-list {
    display: flex;
    flex-direction: column;
    gap: 1px;
    max-height: 220px;
    overflow-y: auto
}

.add-campo-popup-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 4px
}

.add-campo-popup-title {
    font-size: .7rem;
    font-weight: 700;
    color: #6b7a99;
    text-transform: uppercase;
    letter-spacing: .04em;
    padding: 0 2px 4px 2px;
    border-bottom: 1px solid #eee;
    margin-bottom: 4px
}

.add-campo-popup-sep {
    border: none;
    border-top: 1px solid #f0f0f8;
    margin: 4px 0
}

.add-campo-tipo-btn {
    position: relative;
    padding: 2px 7px;
    border-radius: 4px;
    border: 1px solid #dde2ef;
    background: #f8f9ff;
    color: #5b21b6;
    font-size: .82rem;
    cursor: pointer;
    line-height: 1;
    transition: background .1s
}

    .add-campo-tipo-btn:hover {
        background: #f4f0ff;
        border-color: #c8b8f5
    }

        .add-campo-tipo-btn:hover .add-campo-tipo-tooltip {
            display: block
        }

.add-campo-tipo-tooltip {
    display: none;
    position: absolute;
    bottom: calc(100% + 5px);
    left: 50%;
    transform: translateX(-50%);
    background: #1a2340;
    color: white;
    font-size: .68rem;
    font-weight: 600;
    white-space: nowrap;
    padding: 3px 7px;
    border-radius: 4px;
    pointer-events: none;
    z-index: 10000
}

    .add-campo-tipo-tooltip::after {
        content: '';
        position: absolute;
        top: 100%;
        left: 50%;
        transform: translateX(-50%);
        border: 4px solid transparent;
        border-top-color: #1a2340
    }

.add-campo-popup-btn {
    padding: 5px 10px;
    border-radius: 5px;
    border: none;
    background: transparent;
    font-size: .76rem;
    font-weight: 600;
    color: #1a2340;
    cursor: pointer;
    text-align: left;
    width: 100%;
    transition: background .1s
}

    .add-campo-popup-btn:hover {
        background: #f4f0ff;
        color: #5b21b6
    }

.add-campo-popup-btn-field {
    color: #EF7F1A
}

    .add-campo-popup-btn-field:hover {
        background: #fff5ec;
        color: #EF7F1A
    }

.hf-separador {
    border: none;
    border-top: 2px dashed #c8b8f5;
    margin: 14px 0
}

.nivel-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 12px
}

.nivel-tab-btn {
    padding: 4px 14px;
    border-radius: 20px;
    border: 1px solid #c8b8f5;
    font-size: .74rem;
    font-weight: 700;
    cursor: pointer;
    background: #f4f0ff;
    color: #5b21b6;
    transition: all .12s;
    white-space: nowrap
}

    .nivel-tab-btn:hover {
        background: #ede9fe;
        border-color: #a78bfa
    }

    .nivel-tab-btn.nivel-tab-ativo {
        background: #5b21b6;
        color: white;
        border-color: #5b21b6
    }

.dd-ctx-menu {
    position: fixed;
    background: white;
    border: 1px solid #dde2ef;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0,0,0,.15);
    z-index: 9999;
    min-width: 220px;
    padding: 6px 0;
    font-size: .8rem
}

.dd-ctx-title {
    padding: 6px 14px 4px;
    font-size: .7rem;
    font-weight: 700;
    color: #6b7a99;
    border-bottom: 1px solid #eee;
    margin-bottom: 4px
}

.dd-ctx-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 14px
}

    .dd-ctx-row label {
        font-size: .72rem;
        color: #6b7a99;
        white-space: nowrap;
        min-width: 52px
    }

    .dd-ctx-row input[type=text], .dd-ctx-row input[type=number] {
        flex: 1;
        padding: 3px 6px;
        font-size: .78rem;
        border: 1px solid #dde2ef;
        border-radius: 4px;
        min-width: 0
    }

    .dd-ctx-row input[type=color] {
        width: 26px;
        height: 24px;
        padding: 1px;
        border: 1px solid #dde2ef;
        border-radius: 3px;
        cursor: pointer
    }

    .dd-ctx-row select {
        flex: 1;
        padding: 3px 5px;
        font-size: .75rem;
        border: 1px solid #dde2ef;
        border-radius: 4px
    }

.dd-ctx-btn {
    display: block;
    width: calc(100% - 16px);
    margin: 4px 8px 0;
    padding: 6px 10px;
    border-radius: 5px;
    border: none;
    background: #fee;
    color: #c0392b;
    cursor: pointer;
    font-size: .76rem;
    font-weight: 600;
    text-align: left
}

    .dd-ctx-btn:hover {
        background: #fdd
    }

.dd-ctx-sep {
    border: none;
    border-top: 1px solid #eee;
    margin: 6px 0
}

.dd-ctx-bold-on {
    padding: 2px 10px;
    border-radius: 4px;
    border: 1px solid #EF7F1A;
    background: #EF7F1A;
    color: white;
    cursor: pointer;
    font-weight: 700
}

.canvas-resize-handle {
    width: 756px;
    height: 6px;
    background: #dde2ef;
    cursor: ns-resize;
    display: block;
    user-select: none
}

    .canvas-resize-handle:hover {
        background: #5b21b6
    }

.detalhe-separador {
    border: none;
    border-top: 2px dashed #fcd9b0;
    margin: 10px 0 8px 0
}

.detalhe-wrap {
    background: #fff8f2;
    border: 1px solid #fcd9b0;
    border-radius: 7px;
    padding: 8px 10px;
    margin-bottom: 8px
}

.detalhe-title {
    font-size: .72rem;
    font-weight: 400;
    color: #EF7F1A;
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    margin-bottom: 6px
}

@keyframes pulse {
    0%, 100% {
        opacity: 1
    }

    50% {
        opacity: .5
    }
}

.zoom-btn {
    padding: 2px 9px;
    border-radius: 4px;
    border: 1px solid #c8b8f5;
    font-size: .68rem;
    font-weight: 700;
    cursor: pointer;
    background: white;
    color: #5b21b6;
    transition: all .1s;
    white-space: nowrap
}

    .zoom-btn:hover {
        background: #ede9fe;
        border-color: #a78bfa
    }

    .zoom-btn.zoom-ativo {
        background: #5b21b6;
        color: white;
        border-color: #5b21b6
    }
