/* Custom report editor + WYSIWYG slide canvas */

.cre-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .45);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10010;
}

.custom-report-editor {
    background: #fff;
    width: 100vw;
    height: 100vh;
    max-height: none;
    border-radius: 0;
    overflow: hidden;
    padding: 12px;
    box-shadow: none;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
}

.cre-toolbar {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
}

.cre-status {
    flex: 1;
    color: #008180;
    font-size: 13px;
}

.cre-body {
    display: grid;
    grid-template-columns: 220px 1fr 380px;
    gap: 10px;
    flex: 1;
    min-height: 0;
}

.cre-pages, .cre-inspector {
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 8px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-height: 0;
    overflow: auto;
}

.cre-canvas {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 0;
    min-height: 0;
    overflow: auto;
}

.cre-canvas-head {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.cre-section-title {
    font-weight: 600;
    font-size: 13px;
    color: #374151;
    margin-top: 4px;
}

.cre-page-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    padding: 6px 8px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
}

.cre-page-item:hover {
    background: #e0f7f4;
}

.cre-page-item.selected {
    background: #d1f0ec;
    font-weight: 600;
}

.cre-add-blocks {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.rc-master-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    font-size: 12px;
    color: #6b7280;
}

.rc-master-bar label {
    display: flex;
    align-items: center;
    gap: 4px;
}

.rc-inline {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: #6b7280;
}

.cre-name {
    width: 100%;
    padding: 6px 8px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
}

.cre-textarea {
    width: 100%;
    min-height: 80px;
    padding: 6px 8px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
}

.cre-inspector label {
    display: flex;
    flex-direction: column;
    font-size: 12px;
    gap: 2px;
    color: #6b7280;
}

.cre-block {
    margin-top: 6px;
}

.cre-mini {
    background: none;
    border: none;
    cursor: pointer;
    color: #9ca3af;
}

.cre-mini:hover {
    color: #dc2626;
}

.cre-empty, .cre-hint {
    color: #6b7280;
    font-size: 13px;
}

.cre-generated {
    margin-top: 10px;
    padding: 10px 12px;
    background: #e0f7f4;
    border: 1px solid #b6e3dd;
    border-radius: 8px;
    font-size: 13px;
    color: #0f5e5a;
}

.cre-log {
    max-height: 30vh;
    overflow: auto;
    background: #1f2937;
    color: #f3f4f6;
    padding: 10px;
    border-radius: 8px;
    font-size: 12px;
    white-space: pre-wrap;
}

/* --- slide canvas --- */

.rc-stage {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    background: #e9edf1;
    padding: 14px;
    border-radius: 8px;
    overflow: auto;
}

.rc-slide {
    position: relative;
    width: 100%;
    max-width: 920px;
    aspect-ratio: 16 / 9;
    background: #fff;
    box-shadow: 0 1px 8px rgba(0, 0, 0, .2);
    container-type: size;
    overflow: hidden;
    outline: none;
}

.rc-block {
    position: absolute;
    box-sizing: border-box;
    overflow: hidden;
    cursor: move;
}

.rc-block.selected {
    outline: 1.5px solid #008180;
    z-index: 10;
}

.rc-block.rc-bg {
    pointer-events: none;
    cursor: default;
}

.rc-text-body {
    width: 100%;
    height: 100%;
    white-space: pre-wrap;
    overflow: hidden;
    outline: none;
}

.rc-table {
    width: 100%;
    height: 100%;
    border-collapse: collapse;
}

.rc-cell {
    border: 1px solid #d1d5db;
    padding: 2px 4px;
    outline: none;
}

.rc-cell-header {
    background: #008180;
    color: #fff;
    font-weight: bold;
}

.rc-chart {
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100%;
}

.rc-chart-title {
    font-weight: bold;
    text-align: center;
    font-size: 2.4cqh;
}

.rc-chart-plot {
    flex: 1;
    display: flex;
    align-items: flex-end;
    gap: 2px;
    padding: 2px;
}

.rc-bar {
    flex: 1;
    min-width: 3px;
    min-height: 1px;
}

.rc-chart-stack {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 1cqh;
    padding: 2px;
    min-height: 0;
}

.rc-stack-row {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 1.2cqh;
    min-height: 0;
}

.rc-stack-label {
    flex: 0 0 34%;
    font-size: 1.8cqh;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.rc-stack-bar {
    flex: 1;
    display: flex;
    height: 100%;
    min-width: 0;
}

.rc-stack-seg {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.6cqh;
    overflow: hidden;
    white-space: nowrap;
    min-width: 0;
}

.rc-chart-cats {
    display: flex;
    gap: 2px;
    padding: 0 2px 2px;
}

.rc-chart-cat {
    flex: 1;
    min-width: 0;
    text-align: center;
    font-size: 1.8cqh;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.rc-chart-legend {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 1.5cqh;
    padding: 0.5cqh 2px;
    margin-top: 2.5cqh;
}

.rc-legend-item {
    display: inline-flex;
    align-items: center;
    gap: 0.6cqh;
    font-size: 1.8cqh;
}

.rc-legend-swatch {
    width: 1.8cqh;
    height: 1.8cqh;
    border-radius: 2px;
    flex: 0 0 auto;
}

.rc-image {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    color: #6b7280;
    background: #f3f4f6;
    font-size: 2.4cqh;
}

/* resize handles */
.rc-handle {
    position: absolute;
    width: 9px;
    height: 9px;
    background: #fff;
    border: 1px solid #008180;
    border-radius: 2px;
    z-index: 11;
}

.rc-handle-nw { left: -5px; top: -5px; cursor: nwse-resize; }
.rc-handle-n { left: calc(50% - 5px); top: -5px; cursor: ns-resize; }
.rc-handle-ne { right: -5px; top: -5px; cursor: nesw-resize; }
.rc-handle-e { right: -5px; top: calc(50% - 5px); cursor: ew-resize; }
.rc-handle-se { right: -5px; bottom: -5px; cursor: nwse-resize; }
.rc-handle-s { left: calc(50% - 5px); bottom: -5px; cursor: ns-resize; }
.rc-handle-sw { left: -5px; bottom: -5px; cursor: nesw-resize; }
.rc-handle-w { left: -5px; top: calc(50% - 5px); cursor: ew-resize; }

/* alignment guides */
.rc-guide {
    position: absolute;
    background: #f43f5e;
    z-index: 50;
    pointer-events: none;
}

.rc-guide-v { top: 0; bottom: 0; width: 1px; }
.rc-guide-h { left: 0; right: 0; height: 1px; }

/* inspector helpers */
.rc-grid2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
}

.rc-btn-row {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.rc-check {
    flex-direction: row !important;
    align-items: center;
    gap: 6px;
}

.rc-series {
    display: flex;
    gap: 4px;
    align-items: center;
    margin-bottom: 4px;
}

.rc-series .cre-name {
    flex: 1;
    min-width: 0;
}

.rc-series-block {
    border: 1px solid #e3e3e3;
    border-radius: 6px;
    padding: 8px;
    margin-bottom: 8px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.rc-check-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
    max-height: 180px;
    overflow-y: auto;
    border: 1px solid #e3e3e3;
    border-radius: 6px;
    padding: 8px;
    margin-bottom: 8px;
}

.rc-check-list .rc-check {
    align-items: flex-start;
}

/* dataset panel */
.cre-datasets {
    padding: 12px;
    overflow-y: auto;
}

.rc-dataset {
    border: 1px solid #e3e3e3;
    border-radius: 6px;
    padding: 10px;
    margin-bottom: 10px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.rc-dataset-head {
    display: flex;
    gap: 6px;
    align-items: center;
}

.rc-dataset-head .cre-name {
    flex: 1;
    min-width: 0;
}

.rc-dataset-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 0;
    border-bottom: 1px solid #eee;
}

.rc-dataset-name {
    flex: 1;
    min-width: 0;
    font-weight: 600;
}

/* dataset flow editor */
.dfe-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .45);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10020;
}

.dfe-popup {
    background: #fff;
    border-radius: 8px;
    width: min(1200px, 95vw);
    height: 88vh;
    overflow: hidden;
    box-shadow: 0 10px 40px rgba(0, 0, 0, .3);
}

.dfe-root {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
}

.dfe-toolbar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px;
    border-bottom: 1px solid #e3e3e3;
    flex-wrap: wrap;
}

.dfe-palette {
    width: 170px;
    flex-shrink: 0;
    border-right: 1px solid #e3e3e3;
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    overflow-y: auto;
}

.dfe-palette .popup-btn-outline {
    width: 100%;
    text-align: left;
}

.dfe-body {
    display: flex;
    flex: 1;
    min-height: 0;
}

.dfe-canvas {
    flex: 1;
    min-width: 0;
    position: relative;
}

.dfe-inspector {
    width: 260px;
    border-left: 1px solid #e3e3e3;
    padding: 10px;
    overflow-y: auto;
}
