/* Flow Builder Modern Styles */
.flow-builder-container {
    display: flex;
    height: calc(100vh - 175px);
    min-height: 640px;
    background: #f8fafc;
    border-radius: 1rem;
    overflow: hidden;
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.05);
    border: 1px solid #e4e4e7;
    position: relative;
}

.dark-style .flow-builder-container,
.dark .flow-builder-container {
    background: #09090b;
    border-color: #27272a;
    box-shadow: none;
}

/* Left Sidebar */
.builder-sidebar {
    width: 290px;
    flex-shrink: 0;
    background: #ffffff;
    border-right: 1px solid #e4e4e7;
    display: flex;
    flex-direction: column;
    z-index: 2;
    overflow-y: auto;
    padding-bottom: 1.25rem;
}

.dark-style .builder-sidebar,
.dark .builder-sidebar {
    background: #18181b;
    border-right-color: #27272a;
}

.sidebar-section-title {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #71717a;
    padding: 1.1rem 1.1rem 0.45rem;
    font-weight: 700;
}

.dark-style .sidebar-section-title,
.dark .sidebar-section-title {
    color: #a1a1aa;
}

.drag-item {
    margin: 0.25rem 0.85rem;
    padding: 0.65rem 0.85rem;
    background: #ffffff;
    border: 1px solid #e4e4e7;
    border-radius: 0.75rem;
    cursor: grab;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    transition: all 0.18s ease;
    user-select: none;
}

.dark-style .drag-item,
.dark .drag-item {
    background: #1f1f23;
    border-color: #27272a;
}

.drag-item:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(3, 122, 255, 0.08);
    border-color: #037aff;
}

.drag-item:active {
    cursor: grabbing;
}

.drag-item i {
    font-size: 1.15rem;
    width: 34px;
    height: 34px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.6rem;
    background: rgba(3, 122, 255, 0.1);
    color: #037aff;
}

.drag-item[data-color="success"] i {
    background: rgba(16, 185, 129, 0.12);
    color: #10b981;
}

.drag-item[data-color="warning"] i {
    background: rgba(245, 158, 11, 0.12);
    color: #f59e0b;
}

.drag-item[data-color="info"] i {
    background: rgba(6, 182, 212, 0.12);
    color: #06b6d4;
}

.drag-item[data-color="danger"] i {
    background: rgba(239, 68, 68, 0.12);
    color: #ef4444;
}

.drag-item[data-color="secondary"] i {
    background: rgba(113, 113, 122, 0.12);
    color: #71717a;
}

.drag-item .item-title {
    font-weight: 600;
    font-size: 0.8125rem;
    color: #18181b;
    line-height: 1.25;
}

.dark-style .drag-item .item-title,
.dark .drag-item .item-title {
    color: #f4f4f5;
}

.drag-item .item-desc {
    font-size: 0.7rem;
    color: #71717a;
    display: block;
    margin-top: 0.1rem;
    line-height: 1.3;
}

.dark-style .drag-item .item-desc,
.dark .drag-item .item-desc {
    color: #a1a1aa;
}

/* Canvas Area */
.builder-canvas {
    flex-grow: 1;
    position: relative;
    overflow: hidden;
    background-color: #f8fafc;
    background-image: radial-gradient(#cbd5e1 1px, transparent 1px);
    background-size: 20px 20px;
}

.dark-style .builder-canvas,
.dark .builder-canvas {
    background-color: #0c0c0e;
    background-image: radial-gradient(#27272a 1px, transparent 1px);
}

#drawflow {
    width: 100%;
    height: 100%;
}

/* =========================================================================
 * Drawflow Node Overrides (Fix Red Background from drawflow.min.css)
 * ========================================================================= */
.drawflow .drawflow-node {
    background: #ffffff !important;
    border: 1.5px solid #e4e4e7 !important;
    border-radius: 0.875rem !important;
    box-shadow: 0 4px 14px -2px rgba(15, 23, 42, 0.07), 0 2px 4px -2px rgba(15, 23, 42, 0.04) !important;
    padding: 0 !important;
    width: 260px !important;
    color: #27272a !important;
    transition: box-shadow 0.2s ease, border-color 0.2s ease, transform 0.15s ease !important;
}

.dark-style .drawflow .drawflow-node,
.dark .drawflow .drawflow-node {
    background: #18181b !important;
    border-color: #27272a !important;
    color: #e4e4e7 !important;
    box-shadow: 0 8px 20px -4px rgba(0, 0, 0, 0.45) !important;
}

.drawflow .drawflow-node:hover {
    border-color: #cbd5e1 !important;
    box-shadow: 0 8px 20px -4px rgba(15, 23, 42, 0.12) !important;
}

.dark-style .drawflow .drawflow-node:hover,
.dark .drawflow .drawflow-node:hover {
    border-color: #3f3f46 !important;
}

/* Override drawflow.min.css `.drawflow .drawflow-node.selected { background: red; }` */
.drawflow .drawflow-node.selected {
    background: #ffffff !important;
    border: 2px solid #037aff !important;
    box-shadow: 0 0 0 4px rgba(3, 122, 255, 0.16), 0 12px 24px -4px rgba(3, 122, 255, 0.15) !important;
}

.dark-style .drawflow .drawflow-node.selected,
.dark .drawflow .drawflow-node.selected {
    background: #18181b !important;
    border: 2px solid #3b82f6 !important;
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.24), 0 12px 28px -4px rgba(0, 0, 0, 0.6) !important;
}

.drawflow-node .node-header {
    padding: 0.7rem 0.95rem;
    border-bottom: 1px solid #f1f5f9;
    display: flex;
    align-items: center;
    gap: 0.55rem;
    font-weight: 600;
    font-size: 0.8125rem;
    border-radius: 0.75rem 0.75rem 0 0;
    background: #fafafa;
    color: #18181b;
}

.dark-style .drawflow-node .node-header,
.dark .drawflow-node .node-header {
    border-bottom-color: #27272a;
    background: #202024;
    color: #f4f4f5;
}

.drawflow-node .node-header i {
    font-size: 1.05rem;
    width: 26px;
    height: 26px;
    border-radius: 0.5rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(3, 122, 255, 0.12);
    color: #037aff;
}

.drawflow-node .node-body {
    padding: 0.85rem 0.95rem;
    font-size: 0.75rem;
    line-height: 1.45;
    color: #52525b;
    background: transparent;
    border-radius: 0 0 0.75rem 0.75rem;
}

.dark-style .drawflow-node .node-body,
.dark .drawflow-node .node-body {
    color: #a1a1aa;
}

/* Node Header Accent Colors */
.node-primary .node-header { border-top: 3px solid #037aff; }
.node-primary .node-header i { background: rgba(3, 122, 255, 0.12); color: #037aff; }

.node-success .node-header { border-top: 3px solid #10b981; }
.node-success .node-header i { background: rgba(16, 185, 129, 0.12); color: #10b981; }

.node-warning .node-header { border-top: 3px solid #f59e0b; }
.node-warning .node-header i { background: rgba(245, 158, 11, 0.12); color: #f59e0b; }

.node-info .node-header { border-top: 3px solid #06b6d4; }
.node-info .node-header i { background: rgba(6, 182, 212, 0.12); color: #06b6d4; }

.node-danger .node-header { border-top: 3px solid #ef4444; }
.node-danger .node-header i { background: rgba(239, 68, 68, 0.12); color: #ef4444; }

.node-secondary .node-header { border-top: 3px solid #71717a; }
.node-secondary .node-header i { background: rgba(113, 113, 122, 0.12); color: #71717a; }

/* Drawflow Ports & Connections */
.drawflow .drawflow-node .input,
.drawflow .drawflow-node .output {
    width: 14px !important;
    height: 14px !important;
    background: #ffffff !important;
    border: 2.5px solid #037aff !important;
    border-radius: 9999px !important;
    transition: transform 0.15s ease, background-color 0.15s ease !important;
    cursor: crosshair !important;
    pointer-events: auto !important;
    z-index: 11 !important;
}

/* Drawflow Ports Container & Multiple Outputs Positioning */
.drawflow .drawflow-node .outputs {
    position: absolute;
    right: -7px;
    top: 0;
    bottom: 0;
    width: 14px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 8px;
    z-index: 10;
    pointer-events: none;
}

.drawflow .drawflow-node .outputs .output {
    position: relative;
    right: 0 !important;
    margin: 0 !important;
    pointer-events: auto !important;
    cursor: crosshair !important;
}

/* aligned-to-rows modunda output portları JS ile konumlandırılır */
.drawflow .drawflow-node .outputs.aligned-to-rows .output {
    position: absolute !important;
    right: -7px !important;
    pointer-events: auto !important;
}

.drawflow .drawflow-node .inputs {
    position: absolute;
    left: -7px;
    top: 0;
    bottom: 0;
    width: 14px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 10;
    pointer-events: none;
}

.drawflow .drawflow-node .inputs .input {
    position: relative;
    left: 0 !important;
    top: 0 !important;
    margin: 0 !important;
    pointer-events: auto !important;
    cursor: crosshair !important;
}

/* Distinct output colors for instagram_comment node */
.drawflow .drawflow-node.instagram_comment .outputs .output_1 {
    border-color: #037aff !important;
}

.drawflow .drawflow-node.instagram_comment .outputs .output_1:hover {
    background: #037aff !important;
}

/* Distinct output colors for instagram_message node */
.drawflow .drawflow-node.instagram_message .outputs .output_1 {
    border-color: #f59e0b !important; /* Warning / Amber for Default Output #1 */
}

.drawflow .drawflow-node.instagram_message .outputs .output_1:hover {
    background: #f59e0b !important;
}

.drawflow .drawflow-node.instagram_message .outputs .output:not(.output_1) {
    border-color: #10b981 !important; /* Success / Emerald for Payload Outputs #2..#N */
}

.drawflow .drawflow-node.instagram_message .outputs .output:not(.output_1):hover {
    background: #10b981 !important;
}

/* =========================================================================
 * Multiple Outputs Table & Aligned Output Ports
 * ========================================================================= */
.drawflow .drawflow-node .outputs.aligned-to-rows {
    position: absolute;
    top: 0;
    bottom: 0;
    right: 0;
    width: 0;
    height: 100%;
    display: block !important;
    pointer-events: none;
}

.drawflow .drawflow-node .outputs.aligned-to-rows .output {
    position: absolute !important;
    right: -7px !important;
    pointer-events: auto !important;
}

/* Outputs Table Container — sadece satır ayırıcılar, dış çerçeve yok, gölge yok */
.node-outputs-table {
    display: flex;
    flex-direction: column;
    margin-top: 0.45rem;
    border: none !important;
    background: transparent !important;
    box-shadow: none !important;
    padding: 0;
}

.dark-style .node-outputs-table,
.dark .node-outputs-table {
    border: none !important;
    background: transparent !important;
    box-shadow: none !important;
}

/* Output Table Row */
.node-output-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 32px;
    padding: 0.25rem 0.65rem;
    border-bottom: 1px solid rgba(228, 228, 231, 0.75);
    box-sizing: border-box;
    transition: background-color 0.15s ease;
    cursor: default;
    box-shadow: none !important;
}

.node-output-row:last-child {
    border-bottom: none !important;
}

.dark-style .node-output-row,
.dark .node-output-row {
    border-bottom-color: rgba(39, 39, 42, 0.75);
}

.node-output-row:hover,
.node-output-row.row-highlighted {
    background: rgba(0, 0, 0, 0.035);
    box-shadow: none !important;
    border-radius: 4px;
}

.dark-style .node-output-row:hover,
.dark .node-output-row:hover,
.dark-style .node-output-row.row-highlighted,
.dark .node-output-row.row-highlighted {
    background: rgba(255, 255, 255, 0.05);
    box-shadow: none !important;
    border-radius: 4px;
}

.node-output-label {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    min-width: 0;
    flex: 1;
}

.node-output-num {
    font-size: 9px;
    font-weight: 700;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    color: #a1a1aa;
    line-height: 1;
    flex-shrink: 0;
}

.dark-style .node-output-num,
.dark .node-output-num {
    color: #71717a;
}

.node-output-row .badge {
    font-size: 10px !important;
    padding: 0.18rem 0.5rem;
    line-height: 1.2;
    white-space: nowrap;
    text-overflow: ellipsis;
    overflow: hidden;
    max-width: 140px;
    display: inline-flex;
    align-items: center;
}

.node-output-guide {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-left: 0.25rem;
    flex-shrink: 0;
}

.node-output-arrow {
    font-size: 10px;
    opacity: 0.55;
    transition: transform 0.15s ease, opacity 0.15s ease;
}

.node-output-row:hover .node-output-arrow {
    opacity: 1;
    transform: translateX(2px);
}

/* Output Port Colors matching badge colors */
.drawflow .drawflow-node .outputs .output.out-color-success,
.drawflow .drawflow-node .outputs .output[data-color="success"] {
    border-color: #10b981 !important;
}
.drawflow .drawflow-node .outputs .output.out-color-success:hover,
.drawflow .drawflow-node .outputs .output.out-color-success.output-highlighted,
.drawflow .drawflow-node .outputs .output[data-color="success"]:hover,
.drawflow .drawflow-node .outputs .output[data-color="success"].output-highlighted {
    background: #10b981 !important;
    box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.25) !important;
    transform: scale(1.2);
}

.drawflow .drawflow-node .outputs .output.out-color-warning,
.drawflow .drawflow-node .outputs .output[data-color="warning"] {
    border-color: #f59e0b !important;
}
.drawflow .drawflow-node .outputs .output.out-color-warning:hover,
.drawflow .drawflow-node .outputs .output.out-color-warning.output-highlighted,
.drawflow .drawflow-node .outputs .output[data-color="warning"]:hover,
.drawflow .drawflow-node .outputs .output[data-color="warning"].output-highlighted {
    background: #f59e0b !important;
    box-shadow: 0 0 0 4px rgba(245, 158, 11, 0.25) !important;
    transform: scale(1.2);
}

.drawflow .drawflow-node .outputs .output.out-color-danger,
.drawflow .drawflow-node .outputs .output[data-color="danger"] {
    border-color: #ef4444 !important;
}
.drawflow .drawflow-node .outputs .output.out-color-danger:hover,
.drawflow .drawflow-node .outputs .output.out-color-danger.output-highlighted,
.drawflow .drawflow-node .outputs .output[data-color="danger"]:hover,
.drawflow .drawflow-node .outputs .output[data-color="danger"].output-highlighted {
    background: #ef4444 !important;
    box-shadow: 0 0 0 4px rgba(239, 68, 68, 0.25) !important;
    transform: scale(1.2);
}

.drawflow .drawflow-node .outputs .output.out-color-info,
.drawflow .drawflow-node .outputs .output[data-color="info"] {
    border-color: #06b6d4 !important;
}
.drawflow .drawflow-node .outputs .output.out-color-info:hover,
.drawflow .drawflow-node .outputs .output.out-color-info.output-highlighted,
.drawflow .drawflow-node .outputs .output[data-color="info"]:hover,
.drawflow .drawflow-node .outputs .output[data-color="info"].output-highlighted {
    background: #06b6d4 !important;
    box-shadow: 0 0 0 4px rgba(6, 182, 212, 0.25) !important;
    transform: scale(1.2);
}

.drawflow .drawflow-node .outputs .output.out-color-primary,
.drawflow .drawflow-node .outputs .output[data-color="primary"] {
    border-color: #037aff !important;
}
.drawflow .drawflow-node .outputs .output.out-color-primary:hover,
.drawflow .drawflow-node .outputs .output.out-color-primary.output-highlighted,
.drawflow .drawflow-node .outputs .output[data-color="primary"]:hover,
.drawflow .drawflow-node .outputs .output[data-color="primary"].output-highlighted {
    background: #037aff !important;
    box-shadow: 0 0 0 4px rgba(3, 122, 255, 0.25) !important;
    transform: scale(1.2);
}

.drawflow .drawflow-node .outputs .output.out-color-secondary,
.drawflow .drawflow-node .outputs .output[data-color="secondary"] {
    border-color: #71717a !important;
}
.drawflow .drawflow-node .outputs .output.out-color-secondary:hover,
.drawflow .drawflow-node .outputs .output.out-color-secondary.output-highlighted,
.drawflow .drawflow-node .outputs .output[data-color="secondary"]:hover,
.drawflow .drawflow-node .outputs .output[data-color="secondary"].output-highlighted {
    background: #71717a !important;
    box-shadow: 0 0 0 4px rgba(113, 113, 122, 0.25) !important;
    transform: scale(1.2);
}

/* Static fallback rules */
.drawflow .drawflow-node.time_since_last_message .outputs .output_1 { border-color: #10b981 !important; }
.drawflow .drawflow-node.time_since_last_message .outputs .output_2 { border-color: #f59e0b !important; }
.drawflow .drawflow-node.time_router .outputs .output_1 { border-color: #10b981 !important; }
.drawflow .drawflow-node.time_router .outputs .output_2 { border-color: #ef4444 !important; }
.drawflow .drawflow-node.content_filter .outputs .output_1 { border-color: #10b981 !important; }
.drawflow .drawflow-node.content_filter .outputs .output_2 { border-color: #ef4444 !important; }
.drawflow .drawflow-node.capture_speech .outputs .output_1 { border-color: #10b981 !important; }
.drawflow .drawflow-node.capture_speech .outputs .output_2 { border-color: #f59e0b !important; }
.drawflow .drawflow-node.voice_survey .outputs .output_1 { border-color: #10b981 !important; }
.drawflow .drawflow-node.voice_survey .outputs .output_2 { border-color: #ef4444 !important; }
.drawflow .drawflow-node.voice_survey .outputs .output_3 { border-color: #f59e0b !important; }
.drawflow .drawflow-node.queue .outputs .output_1 { border-color: #10b981 !important; }
.drawflow .drawflow-node.queue .outputs .output_2 { border-color: #f59e0b !important; }
.drawflow .drawflow-node.queue .outputs .output_3 { border-color: #ef4444 !important; }
.drawflow .drawflow-node.queue .outputs .output_4 { border-color: #71717a !important; }
.drawflow .drawflow-node.queue .outputs .output_5 { border-color: #06b6d4 !important; }

.dark-style .drawflow .drawflow-node .input,
.dark-style .drawflow .drawflow-node .output,
.dark .drawflow .drawflow-node .input,
.dark .drawflow .drawflow-node .output {
    background: #18181b !important;
    border-color: #3b82f6 !important;
}

.drawflow .drawflow-node .input:hover,
.drawflow .drawflow-node .output:hover {
    background: #037aff !important;
    transform: scale(1.2);
}

.drawflow .connection .main-path {
    stroke-width: 2.5px !important;
    stroke: #037aff !important;
}

.drawflow .drawflow-delete {
    background: #ef4444 !important;
    color: #ffffff !important;
    border: 2px solid #ffffff !important;
    box-shadow: 0 4px 10px rgba(239, 68, 68, 0.35) !important;
    font-size: 0.75rem !important;
    line-height: 22px !important;
    width: 26px !important;
    height: 26px !important;
}

/* =========================================================================
 * Right-Hand Properties Panel (#property-panel)
 * ========================================================================= */
.property-panel {
    width: 390px;
    max-width: 92vw;
    background: #ffffff;
    border-left: 1px solid #e4e4e7;
    padding: 0;
    position: absolute;
    right: -410px;
    top: 0;
    bottom: 0;
    transition: right 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    z-index: 20;
    box-shadow: -12px 0 32px -4px rgba(15, 23, 42, 0.08);
    display: flex;
    flex-direction: column;
}

.property-panel.active {
    right: 0;
}

.dark-style .property-panel,
.dark .property-panel {
    background: #18181b;
    border-left-color: #27272a;
    box-shadow: -12px 0 32px -4px rgba(0, 0, 0, 0.5);
}

.prop-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid #e4e4e7;
    background: #ffffff;
    flex-shrink: 0;
}

.dark-style .prop-panel-header,
.dark .prop-panel-header {
    background: #18181b;
    border-bottom-color: #27272a;
}

.prop-panel-title-wrap {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-width: 0;
}

.prop-panel-icon {
    width: 36px;
    height: 36px;
    border-radius: 0.65rem;
    background: rgba(3, 122, 255, 0.1);
    color: #037aff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.15rem;
    flex-shrink: 0;
}

.prop-panel-title {
    margin: 0;
    font-size: 0.925rem;
    font-weight: 700;
    color: #18181b;
    line-height: 1.25;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dark-style .prop-panel-title,
.dark .prop-panel-title {
    color: #f4f4f5;
}

.prop-panel-subtitle {
    display: block;
    font-size: 0.7rem;
    color: #71717a;
    margin-top: 0.1rem;
}

.dark-style .prop-panel-subtitle,
.dark .prop-panel-subtitle {
    color: #a1a1aa;
}

.prop-panel-close {
    width: 32px;
    height: 32px;
    border-radius: 0.5rem;
    border: 1px solid #e4e4e7;
    background: #fafafa;
    color: #71717a;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.15s ease;
    flex-shrink: 0;
}

.prop-panel-close:hover {
    background: #f4f4f5;
    color: #18181b;
    border-color: #d4d4d8;
}

.dark-style .prop-panel-close,
.dark .prop-panel-close {
    background: #27272a;
    border-color: #3f3f46;
    color: #a1a1aa;
}

.dark-style .prop-panel-close:hover,
.dark .prop-panel-close:hover {
    background: #3f3f46;
    color: #f4f4f5;
}

.prop-panel-body {
    flex: 1;
    overflow-y: auto;
    padding: 1.1rem 1.15rem 1.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.9rem;
}

/* Grouped Property Section Cards */
.prop-section {
    background: #fafafa;
    border: 1px solid #e4e4e7;
    border-radius: 0.875rem;
    padding: 0.95rem;
    transition: border-color 0.15s ease;
}

.dark-style .prop-section,
.dark .prop-section {
    background: #121215;
    border-color: #27272a;
}

.prop-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 0.8rem;
    padding-bottom: 0.55rem;
    border-bottom: 1px solid #e4e4e7;
}

.dark-style .prop-section-header,
.dark .prop-section-header {
    border-bottom-color: #27272a;
}

.prop-section-title {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #3f3f46;
}

.dark-style .prop-section-title,
.dark .prop-section-title {
    color: #d4d4d8;
}

.prop-section-title i {
    font-size: 0.95rem;
    color: #037aff;
}

.prop-field {
    margin-bottom: 0.75rem;
}

.prop-field:last-child {
    margin-bottom: 0;
}

.prop-grid-2 {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.65rem;
}

/* Form Labels inside Property Panel */
#property-panel label,
#property-panel .form-label {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.25rem;
    font-size: 0.75rem;
    font-weight: 600;
    color: #3f3f46;
    margin-bottom: 0.35rem;
}

.dark-style #property-panel label,
.dark #property-panel label,
.dark-style #property-panel .form-label,
.dark #property-panel .form-label {
    color: #d4d4d8;
}

/* Form Inputs, Selects & Textareas inside Property Panel */
#property-panel .form-control,
#property-panel select,
#property-panel textarea,
#property-panel input[type="text"],
#property-panel input[type="number"],
#property-panel input[type="url"] {
    width: 100%;
    background-color: #ffffff;
    border: 1px solid #d4d4d8;
    border-radius: 0.65rem;
    padding: 0.5rem 0.75rem;
    font-size: 0.8125rem;
    line-height: 1.4;
    color: #18181b;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
    outline: none;
}

.dark-style #property-panel .form-control,
.dark #property-panel .form-control,
.dark-style #property-panel select,
.dark #property-panel select,
.dark-style #property-panel textarea,
.dark #property-panel textarea,
.dark-style #property-panel input[type="text"],
.dark #property-panel input[type="text"],
.dark-style #property-panel input[type="number"],
.dark #property-panel input[type="number"],
.dark-style #property-panel input[type="url"],
.dark #property-panel input[type="url"] {
    background-color: #18181b;
    border-color: #3f3f46;
    color: #f4f4f5;
}

#property-panel .form-control:focus,
#property-panel select:focus,
#property-panel textarea:focus,
#property-panel input[type="text"]:focus,
#property-panel input[type="number"]:focus,
#property-panel input[type="url"]:focus {
    border-color: #037aff;
    box-shadow: 0 0 0 3px rgba(3, 122, 255, 0.14);
}

#property-panel .form-control::placeholder,
#property-panel textarea::placeholder,
#property-panel input::placeholder {
    color: #a1a1aa;
}

.dark-style #property-panel .form-control::placeholder,
.dark #property-panel .form-control::placeholder {
    color: #52525b;
}

#property-panel textarea.form-control {
    resize: vertical;
    min-height: 68px;
}

/* Input Groups (Dynamic Out Rows & Intent Rows) */
#property-panel .input-group {
    display: flex;
    align-items: stretch;
    width: 100%;
    border-radius: 0.65rem;
    overflow: hidden;
    border: 1px solid #d4d4d8;
    background: #ffffff;
}

.dark-style #property-panel .input-group,
.dark #property-panel .input-group {
    border-color: #3f3f46;
    background: #18181b;
}

#property-panel .input-group:focus-within {
    border-color: #037aff;
    box-shadow: 0 0 0 3px rgba(3, 122, 255, 0.14);
}

#property-panel .input-group .input-group-text {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.4rem 0.65rem;
    font-size: 0.75rem;
    font-weight: 600;
    color: #52525b;
    background: #f4f4f5;
    border-right: 1px solid #d4d4d8;
    white-space: nowrap;
    flex-shrink: 0;
}

.dark-style #property-panel .input-group .input-group-text,
.dark #property-panel .input-group .input-group-text {
    background: #27272a;
    color: #d4d4d8;
    border-right-color: #3f3f46;
}

#property-panel .input-group .form-control {
    border: none !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    flex: 1 1 auto;
    min-width: 0;
    padding: 0.42rem 0.65rem;
}

#property-panel .input-group .btn {
    border: none !important;
    border-left: 1px solid #d4d4d8 !important;
    border-radius: 0 !important;
    padding: 0 0.65rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    color: #ef4444;
    cursor: pointer;
    transition: background-color 0.15s ease;
}

.dark-style #property-panel .input-group .btn,
.dark #property-panel .input-group .btn {
    border-left-color: #3f3f46 !important;
}

#property-panel .input-group .btn:hover {
    background: rgba(239, 68, 68, 0.1);
}

/* Checkboxes & Toggle Switches */
#property-panel .form-check {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    padding: 0.25rem 0;
    margin: 0;
}

#property-panel .form-check-input {
    width: 1.05rem;
    height: 1.05rem;
    border-radius: 0.3rem;
    border: 1.5px solid #a1a1aa;
    appearance: auto;
    accent-color: #037aff;
    cursor: pointer;
    flex-shrink: 0;
    margin: 0;
}

#property-panel .form-switch .form-check-input {
    width: 2.25rem;
    height: 1.25rem;
    appearance: none;
    background-color: #d4d4d8;
    border-radius: 9999px;
    border: none;
    position: relative;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.dark-style #property-panel .form-switch .form-check-input,
.dark #property-panel .form-switch .form-check-input {
    background-color: #3f3f46;
}

#property-panel .form-switch .form-check-input::after {
    content: "";
    position: absolute;
    top: 2px;
    left: 2px;
    width: 1rem;
    height: 1rem;
    border-radius: 50%;
    background: #ffffff;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
    transition: transform 0.2s ease;
}

#property-panel .form-switch .form-check-input:checked {
    background-color: #10b981;
}

#property-panel .form-switch .form-check-input:checked::after {
    transform: translateX(1rem);
}

#property-panel .form-check-label {
    margin-bottom: 0 !important;
    cursor: pointer;
    font-size: 0.78rem;
    color: #27272a;
}

.dark-style #property-panel .form-check-label,
.dark #property-panel .form-check-label {
    color: #e4e4e7;
}

/* Buttons inside Property Panel */
#property-panel .btn-outline-primary,
#property-panel .prop-btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    width: 100%;
    padding: 0.5rem 0.85rem;
    border-radius: 0.65rem;
    border: 1px dashed #037aff;
    background: rgba(3, 122, 255, 0.06);
    color: #037aff;
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
}

#property-panel .btn-outline-primary:hover,
#property-panel .prop-btn-primary:hover {
    background: rgba(3, 122, 255, 0.12);
    border-style: solid;
}

/* Intent Item Card */
.intent-item-card {
    background: #ffffff;
    border: 1px solid #e4e4e7;
    border-radius: 0.75rem;
    padding: 0.75rem;
    margin-bottom: 0.6rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.dark-style .intent-item-card,
.dark .intent-item-card {
    background: #18181b;
    border-color: #27272a;
}

/* Time Slot Card */
.time-slot-card {
    background: #ffffff;
    border: 1px solid #e4e4e7;
    border-radius: 0.75rem;
    padding: 0.75rem;
    margin-bottom: 0.65rem;
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03);
}

.dark-style .time-slot-card,
.dark .time-slot-card {
    background: #18181b;
    border-color: #27272a;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

/* Day Selection Chips */
.day-chips-container {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-top: 6px;
}

.day-chip {
    padding: 3px 9px;
    font-size: 11px;
    font-weight: 500;
    border-radius: 6px;
    border: 1px solid #e4e4e7;
    background: #ffffff;
    color: #4b5563;
    cursor: pointer;
    transition: all 0.15s ease;
    user-select: none;
    line-height: 1.4;
}

.day-chip:hover {
    border-color: #037aff;
    color: #037aff;
    background: rgba(3, 122, 255, 0.04);
}

.day-chip.active {
    background: #037aff;
    border-color: #037aff;
    color: #ffffff;
    box-shadow: 0 2px 4px rgba(3, 122, 255, 0.2);
}

.dark-style .day-chip,
.dark .day-chip {
    background: #202024;
    border-color: #2e2e33;
    color: #d4d4d8;
}

.dark-style .day-chip:hover,
.dark .day-chip:hover {
    border-color: #3b82f6;
    color: #3b82f6;
    background: rgba(59, 130, 246, 0.1);
}

.dark-style .day-chip.active,
.dark .day-chip.active {
    background: #3b82f6;
    border-color: #3b82f6;
    color: #ffffff;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.day-presets {
    display: flex;
    gap: 4px;
}

.day-preset-btn {
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 4px;
    background: transparent;
    border: 1px dashed #cbd5e1;
    color: #64748b;
    cursor: pointer;
    line-height: 1.2;
    transition: all 0.15s ease;
}

.day-preset-btn:hover {
    border-color: #037aff;
    color: #037aff;
    border-style: solid;
}

.dark-style .day-preset-btn,
.dark .day-preset-btn {
    border-color: #3f3f46;
    color: #a1a1aa;
}

.dark-style .day-preset-btn:hover,
.dark .day-preset-btn:hover {
    border-color: #3b82f6;
    color: #3b82f6;
    border-style: solid;
}

/* Exit Branch Indicators */
.exit-branch-list {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
}

.exit-branch-item {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.55rem 0.75rem;
    border-radius: 0.65rem;
    font-size: 0.75rem;
    line-height: 1.35;
}

.exit-branch-success {
    background: rgba(16, 185, 129, 0.08);
    border: 1px solid rgba(16, 185, 129, 0.25);
    color: #065f46;
}

.dark .exit-branch-success,
.dark-style .exit-branch-success {
    color: #6ee7b7;
}

.exit-branch-warning {
    background: rgba(245, 158, 11, 0.08);
    border: 1px solid rgba(245, 158, 11, 0.25);
    color: #92400e;
}

.dark .exit-branch-warning,
.dark-style .exit-branch-warning {
    color: #fcd34d;
}

.exit-branch-danger {
    background: rgba(239, 68, 68, 0.08);
    border: 1px solid rgba(239, 68, 68, 0.25);
    color: #991b1b;
}

.dark .exit-branch-danger,
.dark-style .exit-branch-danger {
    color: #fca5a5;
}

.exit-branch-info {
    background: rgba(3, 122, 255, 0.07);
    border: 1px solid rgba(3, 122, 255, 0.2);
    color: #1e40af;
}

.dark .exit-branch-info,
.dark-style .exit-branch-info {
    color: #93c5fd;
}

/* Badges (Both on Canvas Nodes & Inside Sidebar) */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.18rem 0.5rem;
    border-radius: 9999px;
    font-size: 0.68rem;
    font-weight: 600;
    line-height: 1.2;
    white-space: nowrap;
}

.bg-success,
.bg-label-success {
    background: rgba(16, 185, 129, 0.14) !important;
    color: #059669 !important;
}

.dark .bg-success,
.dark .bg-label-success {
    background: rgba(16, 185, 129, 0.2) !important;
    color: #34d399 !important;
}

.bg-warning,
.bg-label-warning {
    background: rgba(245, 158, 11, 0.14) !important;
    color: #d97706 !important;
}

.dark .bg-warning,
.dark .bg-label-warning {
    background: rgba(245, 158, 11, 0.2) !important;
    color: #fbbf24 !important;
}

.bg-danger,
.bg-label-danger {
    background: rgba(239, 68, 68, 0.14) !important;
    color: #dc2626 !important;
}

.dark .bg-danger,
.dark .bg-label-danger {
    background: rgba(239, 68, 68, 0.2) !important;
    color: #f87171 !important;
}

.bg-secondary,
.bg-label-secondary {
    background: rgba(113, 113, 122, 0.14) !important;
    color: #52525b !important;
}

.dark .bg-secondary,
.dark .bg-label-secondary {
    background: rgba(161, 161, 170, 0.18) !important;
    color: #d4d4d8 !important;
}

/* Help Toggles & Help Boxes */
.flow-help-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #037aff;
    cursor: pointer;
    margin-right: 0.2rem;
    font-size: 0.88rem;
    vertical-align: middle;
    opacity: 0.8;
    transition: opacity 0.15s ease;
}

.flow-help-toggle:hover {
    opacity: 1;
}

.flow-help {
    width: 100%;
    font-size: 0.72rem;
    line-height: 1.45;
    padding: 0.55rem 0.7rem;
    border-radius: 0.6rem;
    background: rgba(3, 122, 255, 0.08);
    border: 1px solid rgba(3, 122, 255, 0.2);
    color: #1d4ed8;
    margin-top: 0.3rem;
    margin-bottom: 0.45rem;
}

.dark .flow-help,
.dark-style .flow-help {
    background: rgba(59, 130, 246, 0.12);
    border-color: rgba(59, 130, 246, 0.25);
    color: #93c5fd;
}

/* Select2 inside Property Panel */
#property-panel .select2-container {
    width: 100% !important;
}

#property-panel .select2-container--default .select2-selection--multiple,
#property-panel .select2-container--default .select2-selection--single {
    background-color: #ffffff !important;
    border: 1px solid #d4d4d8 !important;
    border-radius: 0.65rem !important;
    min-height: 38px !important;
    padding: 2px 6px !important;
}

.dark #property-panel .select2-container--default .select2-selection--multiple,
.dark #property-panel .select2-container--default .select2-selection--single {
    background-color: #18181b !important;
    border-color: #3f3f46 !important;
}

/* Utility Fallbacks for sender-flow.js */
.d-none { display: none !important; }
.d-block { display: block !important; }
.d-flex { display: flex !important; }
.justify-content-between { justify-content: space-between !important; }
.align-items-center { align-items: center !important; }
.gap-2 { gap: 0.5rem !important; }
.w-100 { width: 100% !important; }
.mb-0 { margin-bottom: 0 !important; }
.mb-1 { margin-bottom: 0.25rem !important; }
.mb-2 { margin-bottom: 0.5rem !important; }
.mb-3 { margin-bottom: 0.75rem !important; }
.mt-1 { margin-top: 0.25rem !important; }
.mt-2 { margin-top: 0.5rem !important; }
.mt-3 { margin-top: 0.75rem !important; }
.me-1 { margin-right: 0.25rem !important; }
.ms-1 { margin-left: 0.25rem !important; }
.fw-bold { font-weight: 600 !important; }
.small { font-size: 0.75rem !important; }
.text-muted { color: #71717a !important; }
.text-danger { color: #ef4444 !important; }

/* =========================================================================
 * Canvas Floating Controls & Fullscreen Mode
 * ========================================================================= */
.canvas-floating-controls {
    position: absolute;
    top: 1rem;
    right: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    z-index: 15;
    pointer-events: auto;
    transition: right 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.property-panel.active ~ .canvas-floating-controls {
    right: 405px !important;
}

.canvas-control-group {
    display: inline-flex;
    align-items: center;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid rgba(228, 228, 231, 0.9);
    border-radius: 0.75rem;
    padding: 0.25rem;
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.08);
}

.dark .canvas-control-group,
.dark-style .canvas-control-group {
    background: rgba(24, 24, 27, 0.95);
    border-color: rgba(39, 39, 42, 0.9);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

.canvas-control-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 0.5rem;
    color: #52525b;
    background: transparent;
    border: none;
    cursor: pointer;
    transition: all 0.15s ease;
    font-size: 1.1rem;
}

.canvas-control-btn:hover {
    background: rgba(0, 0, 0, 0.06);
    color: #18181b;
}

.dark .canvas-control-btn,
.dark-style .canvas-control-btn {
    color: #a1a1aa;
}

.dark .canvas-control-btn:hover,
.dark-style .canvas-control-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #f4f4f5;
}

/* Fullscreen Mode */
.flow-builder-container.is-fullscreen,
.flow-builder-container:fullscreen,
.flow-builder-container:-webkit-full-screen {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    max-height: 100vh !important;
    border-radius: 0 !important;
    z-index: 99999 !important;
    margin: 0 !important;
    border: none !important;
    box-shadow: none !important;
    background: #ffffff !important;
}

.dark .flow-builder-container.is-fullscreen,
.dark-style .flow-builder-container.is-fullscreen,
.dark .flow-builder-container:fullscreen,
.dark-style .flow-builder-container:fullscreen,
.dark .flow-builder-container:-webkit-full-screen,
.dark-style .flow-builder-container:-webkit-full-screen {
    background: #09090b !important;
}

.flow-builder-container.is-fullscreen .builder-sidebar,
.flow-builder-container:fullscreen .builder-sidebar,
.flow-builder-container:-webkit-full-screen .builder-sidebar {
    height: 100vh !important;
    max-height: 100vh !important;
}

.flow-builder-container.is-fullscreen .builder-canvas,
.flow-builder-container:fullscreen .builder-canvas,
.flow-builder-container:-webkit-full-screen .builder-canvas {
    height: 100vh !important;
    max-height: 100vh !important;
}
