* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
        'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow: hidden;
}

/* Botão de tema (sol/lua) */
.sidebar {
    position: relative;
}

.sidebar_footer {
    position: absolute;
    left: 12px;
    bottom: 12px;
    z-index: 15;
}

.theme_icon_btn {
    width: 44px;
    height: 44px;
    border-radius: 14px;
    border: 1px solid #e2e8f0;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
}

.theme_icon_btn:hover {
    background: rgba(248, 250, 252, 0.95);
    border-color: #cbd5e1;
    transform: translateY(-1px);
}

.theme_icon_btn:active {
    transform: translateY(0);
}

.theme_icon {
    font-size: 18px;
    line-height: 1;
}

/* =========================
   MODO ESCURO (body.dark)
   ========================= */
body.dark {
    background-color: #0b1220;
    color: #e2e8f0;
}

body.dark .flow_editor_container {
    background-color: #0b1220;
}

body.dark .sidebar {
    background: linear-gradient(180deg, #0f172a 0%, #0b1220 100%);
    border-right-color: #1f2937;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.35);
}

body.dark .sidebar_header h2 {
    color: #e2e8f0;
}

body.dark .sidebar_header p,
body.dark .session_uid {
    color: #94a3b8;
}

body.dark .session_uid:hover {
    color: #cbd5e1;
}

body.dark .flow_store_btn {
    background-color: #0f172a;
    border-color: #1f2937;
    color: #cbd5e1;
}

body.dark .flow_store_btn:hover {
    background-color: #111c33;
    border-color: #334155;
}

body.dark .node_type_item {
    background-color: #0f172a;
    border-color: #1f2937;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.35);
}

body.dark .node_type_item:hover {
    background-color: #111c33;
    border-color: #334155;
    box-shadow: 0 6px 14px rgba(0, 0, 0, 0.45);
}

body.dark .node_title {
    color: #e2e8f0;
}

body.dark .node_description {
    color: #94a3b8;
}

body.dark .flow_canvas {
    background-color: #0b1220;
}

body.dark .canvas_grid {
    background-image: radial-gradient(circle, rgba(148, 163, 184, 0.28) 1px, transparent 1px);
}

body.dark .flow_node {
    background: #0f172a;
    border-color: #1f2937;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.45);
}

body.dark .flow_node.selected {
    border-color: #38bdf8;
    box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.18);
}

body.dark .node_body {
    background-color: #0b1220;
    border-top-color: #1f2937;
}

body.dark .node_type_badge {
    background-color: #111c33;
    color: #cbd5e1;
}

body.dark .node_status {
    color: #94a3b8;
}

body.dark .output_label {
    color: #cbd5e1;
    background-color: rgba(15, 23, 42, 0.9);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.45);
}

body.dark .connection_line {
    stroke: #38bdf8;
}

body.dark .connection_arrow {
    fill: #38bdf8;
}

body.dark .config_modal_overlay {
    background-color: rgba(0, 0, 0, 0.65);
}

body.dark .config_modal_content {
    background-color: #0f172a;
}

body.dark .config_modal_body {
    background-color: #0f172a;
}

body.dark .type_card {
    background-color: #0b1220;
    border-color: #1f2937;
}

body.dark .type_card:hover {
    background-color: #111c33;
    border-color: #38bdf8;
    box-shadow: 0 10px 18px rgba(0, 0, 0, 0.45);
}

body.dark .type_name {
    color: #e2e8f0;
}

body.dark .type_description {
    color: #94a3b8;
}

body.dark .field_label {
    color: #e2e8f0;
}

body.dark .field_input,
body.dark .case_value,
body.dark .range_min,
body.dark .range_max,
body.dark .range_label,
body.dark .kv_key,
body.dark .kv_value {
    background-color: #0b1220;
    border-color: #1f2937;
    color: #e2e8f0;
}

body.dark .field_input:focus,
body.dark .case_value:focus,
body.dark .range_min:focus,
body.dark .range_max:focus,
body.dark .range_label:focus,
body.dark .kv_key:focus,
body.dark .kv_value:focus {
    border-color: #38bdf8;
    box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.18);
}

.flow_editor_container {
    display: flex;
    width: 100vw;
    height: 100vh;
    background-color: #f8fafc;
}

.sidebar {
    width: 280px;
    background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
    border-right: 1px solid #e2e8f0;
    padding: 24px;
    box-shadow: 2px 0 8px rgba(0, 0, 0, 0.05);
    overflow-y: auto;
    z-index: 10;
}

.sidebar_header {
    margin-bottom: 28px;
}

.sidebar_header_top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.sidebar_toggle_btn {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    border: 1px solid #e2e8f0;
    background-color: #ffffff;
    color: #334155;
    cursor: pointer;
    transition: all 0.15s ease;
    flex: 0 0 auto;
}

.sidebar_toggle_btn:hover {
    background-color: #f8fafc;
    border-color: #cbd5e1;
}

.canvas_topbar {
    position: absolute;
    top: 12px;
    right: 12px;
    z-index: 20;
    pointer-events: auto;
    display: flex;
    align-items: center;
    gap: 10px;
}

.webhook_status {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border-radius: 12px;
    border: 1px solid rgba(226, 232, 240, 0.9);
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(10px);
    font-size: 12px;
    font-weight: 800;
    color: #475569;
}

.webhook_dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #94a3b8; /* neutro */
    box-shadow: 0 0 0 3px rgba(148, 163, 184, 0.18);
}

.webhook_status.ok .webhook_dot {
    background: #10b981;
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.18);
}

.webhook_status.warn .webhook_dot {
    background: #f59e0b;
    box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.18);
}

.webhook_status.err .webhook_dot {
    background: #ef4444;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.18);
}

body.dark .webhook_status {
    border-color: rgba(51, 65, 85, 0.9);
    background: rgba(15, 23, 42, 0.88);
    color: #cbd5e1;
}

.canvas_uid {
    display: inline-block;
    padding: 8px 10px;
    border-radius: 12px;
    border: 1px solid rgba(226, 232, 240, 0.9);
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(10px);
}

/* Sidebar recolhida */
body.sidebar_collapsed .sidebar {
    width: 72px;
    padding: 16px 10px;
}

body.sidebar_collapsed .sidebar_header p,
body.sidebar_collapsed .flow_store_btn {
    display: none;
}

body.sidebar_collapsed .sidebar_header h2 {
    display: none;
}

body.sidebar_collapsed .flow_store_actions {
    gap: 8px;
}

body.sidebar_collapsed .flow_store_btn {
    width: 44px;
    height: 44px;
    padding: 0;
    border-radius: 12px;
}

body.sidebar_collapsed #flow_save_btn::before {
    content: "💾";
    font-size: 18px;
}

body.sidebar_collapsed #flow_open_btn::before {
    content: "📂";
    font-size: 18px;
}

body.sidebar_collapsed .sidebar_footer {
    left: 14px;
}

body.sidebar_collapsed .node_type_item {
    justify-content: center;
    padding: 12px 0;
}

body.sidebar_collapsed .node_info {
    display: none;
}

body.sidebar_collapsed .node_type_item .node_icon {
    width: 44px;
    height: 44px;
    font-size: 22px;
}

body.sidebar_collapsed .node_types {
    gap: 10px;
}

/* Dark mode ajustes do topbar e toggle */
body.dark .sidebar_toggle_btn {
    background-color: #0f172a;
    border-color: #1f2937;
    color: #cbd5e1;
}

body.dark .sidebar_toggle_btn:hover {
    background-color: #111c33;
    border-color: #334155;
}

body.dark .theme_icon_btn {
    background: rgba(15, 23, 42, 0.88);
    border-color: rgba(51, 65, 85, 0.9);
}

body.dark .theme_icon_btn:hover {
    background: rgba(17, 28, 51, 0.9);
    border-color: rgba(71, 85, 105, 0.9);
}

body.dark .canvas_uid {
    border-color: rgba(51, 65, 85, 0.9);
    background: rgba(15, 23, 42, 0.88);
    color: #cbd5e1;
}

/* Botões no topo do canvas */
.canvas_btn {
    padding: 8px 10px;
    border-radius: 12px;
    border: 1px solid rgba(226, 232, 240, 0.9);
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(10px);
    font-size: 12px;
    font-weight: 700;
    color: #475569;
    cursor: pointer;
    transition: all 0.15s ease;
}

.canvas_btn:hover {
    border-color: rgba(203, 213, 225, 0.95);
    background: rgba(248, 250, 252, 0.95);
}

.canvas_btn.playing {
    border-color: rgba(16, 185, 129, 0.45);
    background: rgba(16, 185, 129, 0.14);
    color: #065f46;
}

body.dark .canvas_btn.playing {
    border-color: rgba(16, 185, 129, 0.45);
    background: rgba(16, 185, 129, 0.12);
    color: #a7f3d0;
}

body.dark .canvas_btn {
    border-color: rgba(51, 65, 85, 0.9);
    background: rgba(15, 23, 42, 0.88);
    color: #cbd5e1;
}

body.dark .canvas_btn:hover {
    border-color: rgba(71, 85, 105, 0.95);
    background: rgba(17, 28, 51, 0.9);
}

/* Painel de eventos (dados chegando) */
.events_panel {
    position: absolute;
    left: 16px;
    bottom: 16px;
    width: 420px;
    max-width: calc(100% - 32px);
    height: 260px;
    max-height: calc(100% - 32px);
    z-index: 25;
    border-radius: 16px;
    border: 1px solid rgba(226, 232, 240, 0.9);
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(12px);
    box-shadow: 0 14px 40px rgba(0, 0, 0, 0.12);
    display: none;
    overflow: hidden;
}

.events_panel.open {
    display: flex;
    flex-direction: column;
}

.events_panel_header {
    padding: 10px 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid rgba(226, 232, 240, 0.9);
}

.events_panel_title {
    font-size: 12px;
    font-weight: 800;
    color: #334155;
}

.events_panel_actions {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.events_panel_btn {
    padding: 6px 10px;
    border-radius: 10px;
    border: 1px solid rgba(226, 232, 240, 0.9);
    background: rgba(248, 250, 252, 0.9);
    cursor: pointer;
    font-size: 12px;
    font-weight: 800;
    color: #475569;
}

.events_panel_btn:hover {
    border-color: rgba(203, 213, 225, 0.95);
    background: rgba(241, 245, 249, 0.95);
}

.events_panel_btn:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.events_panel_close {
    width: 30px;
    height: 30px;
    border-radius: 10px;
    border: 1px solid rgba(226, 232, 240, 0.9);
    background: transparent;
    cursor: pointer;
    font-size: 18px;
    line-height: 1;
    color: #475569;
}

.events_panel_body {
    padding: 10px 12px;
    overflow: auto;
    flex: 1;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    font-size: 11px;
    color: #0f172a;
    white-space: pre-wrap;
}

.events_item {
    padding: 8px 10px;
    border-radius: 12px;
    border: 1px solid rgba(226, 232, 240, 0.9);
    background: rgba(248, 250, 252, 0.8);
    margin-bottom: 10px;
}

.events_item:last-child {
    margin-bottom: 0;
}

.events_item_meta {
    font-family: inherit;
    font-size: 10px;
    font-weight: 800;
    color: #64748b;
    margin-bottom: 6px;
}

.events_empty {
    color: #64748b;
    font-weight: 700;
}

body.dark .events_panel {
    border-color: rgba(51, 65, 85, 0.9);
    background: rgba(15, 23, 42, 0.88);
    box-shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
}

body.dark .events_panel_header {
    border-bottom-color: rgba(51, 65, 85, 0.9);
}

body.dark .events_panel_title {
    color: #e2e8f0;
}

body.dark .events_panel_close {
    border-color: rgba(51, 65, 85, 0.9);
    color: #cbd5e1;
}

body.dark .events_panel_btn {
    border-color: rgba(51, 65, 85, 0.9);
    background: rgba(11, 18, 32, 0.6);
    color: #cbd5e1;
}

body.dark .events_panel_btn:hover {
    border-color: rgba(71, 85, 105, 0.95);
    background: rgba(17, 28, 51, 0.7);
}

body.dark .events_panel_body {
    color: #e2e8f0;
}

body.dark .events_item {
    border-color: rgba(51, 65, 85, 0.9);
    background: rgba(11, 18, 32, 0.6);
}

body.dark .events_item_meta {
    color: #94a3b8;
}

/* Rodapé de configuração no nó */
.node_footer {
    padding: 10px 16px 12px 16px;
    border-top: 1px solid #e2e8f0;
    background-color: #ffffff;
    font-size: 11px;
    color: #64748b;
    line-height: 1.35;
}

.node_footer strong {
    color: #334155;
}

body.dark .node_footer {
    border-top-color: #1f2937;
    background-color: #0f172a;
    color: #94a3b8;
}

body.dark .node_footer strong {
    color: #e2e8f0;
}

.sidebar_header h2 {
    font-size: 24px;
    font-weight: 700;
    color: #1e293b;
    margin-bottom: 8px;
}

.sidebar_header p {
    font-size: 13px;
    color: #64748b;
    font-weight: 400;
}

.session_uid {
    margin-top: 4px;
    font-size: 11px;
    font-weight: 500;
    color: #64748b;
    letter-spacing: 0.02em;
    text-decoration: none;
    display: inline-block;
    padding: 2px 0;
}

.session_uid:hover {
    color: #475569;
    text-decoration: underline;
}

.session_uid.copied {
    color: #10b981;
}

.flow_store_actions {
    margin-top: 6px;
    display: flex;
    gap: 8px;
}

.flow_store_btn {
    padding: 6px 10px;
    font-size: 12px;
    font-weight: 600;
    color: #475569;
    background-color: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.flow_store_btn:hover {
    border-color: #cbd5e1;
    background-color: #f8fafc;
}

.flow_store_btn:active {
    transform: translateY(1px);
}

.node_types {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.node_type_item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
    background-color: #ffffff;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    cursor: grab;
    transition: all 0.2s ease;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.node_type_item:hover {
    background-color: #f8fafc;
    border-color: #cbd5e1;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.12);
}

.node_type_item:active {
    cursor: grabbing;
    transform: translateY(0);
}

.node_type_item .node_icon {
    font-size: 24px;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.node_info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.node_title {
    font-size: 14px;
    font-weight: 600;
    color: #1e293b;
}

.node_description {
    font-size: 12px;
    color: #64748b;
}

.flow_canvas {
    flex: 1;
    height: 100%;
    background-color: #f1f5f9;
    position: relative;
    overflow: hidden;
}

.canvas_grid {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: radial-gradient(circle, #cbd5e1 1px, transparent 1px);
    background-size: 20px 20px;
    pointer-events: none;
}

#connections_svg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: auto;
    z-index: 1;
}

.flow_node {
    position: absolute;
    background: #ffffff;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    min-width: 220px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
    cursor: move;
    z-index: 5;
    will-change: transform;
    transition: box-shadow 0.2s ease;
}

.flow_node:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
}

.flow_node.selected {
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.2);
    z-index: 10;
}

.flow_node.dragging {
    opacity: 0.9;
    cursor: grabbing;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
    z-index: 100;
}

.node_header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 16px;
    color: #ffffff;
    font-weight: 600;
    font-size: 14px;
    border-radius: 8px 8px 0 0;
    cursor: move;
    user-select: none;
}

.node_header .node_icon {
    font-size: 20px;
}

.node_label {
    flex: 1;
    cursor: text;
    user-select: none;
}

.node_label_input {
    flex: 1;
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 4px;
    color: #ffffff;
    padding: 4px 8px;
    font-size: 14px;
    font-weight: 600;
    outline: none;
}

.node_body {
    padding: 14px 16px;
    background-color: #fafafa;
    border-top: 1px solid #e2e8f0;
    cursor: pointer;
}

.node_type_badge {
    display: inline-block;
    padding: 4px 10px;
    background-color: #f1f5f9;
    color: #475569;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    border-radius: 4px;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

.node_status {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: #64748b;
}

.status_dot {
    width: 8px;
    height: 8px;
    background-color: #10b981;
    border-radius: 50%;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

.status_text {
    font-weight: 500;
}

.node_handle {
    position: absolute;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 2px solid #ffffff;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    cursor: crosshair;
    z-index: 15;
    transition: all 0.15s ease;
}

.node_handle:hover {
    width: 18px;
    height: 18px;
    border-width: 3px;
}

.node_handle.input {
    left: -7px;
    top: 50%;
    transform: translateY(-50%);
}

.node_handle.output {
    right: -7px;
    top: 50%;
    transform: translateY(-50%);
}

.node_handle.connecting {
    width: 22px;
    height: 22px;
    border-width: 3px;
    animation: connecting_pulse 0.8s ease-in-out infinite;
}

.node_handle.connecting_target {
    width: 22px;
    height: 22px;
    border-width: 3px;
    border-color: #10b981;
    background-color: #10b981 !important;
    animation: target_pulse 0.6s ease-in-out infinite;
}

@keyframes connecting_pulse {
    0%, 100% {
        transform: translateY(-50%) scale(1);
        box-shadow: 0 0 0 0 rgba(37, 99, 235, 0.7);
    }
    50% {
        transform: translateY(-50%) scale(1.15);
        box-shadow: 0 0 0 8px rgba(37, 99, 235, 0);
    }
}

@keyframes target_pulse {
    0%, 100% {
        transform: translateY(-50%) scale(1);
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
    }
    50% {
        transform: translateY(-50%) scale(1.2);
        box-shadow: 0 0 0 8px rgba(16, 185, 129, 0);
    }
}

.output_label {
    position: absolute;
    right: 20px;
    font-size: 10px;
    font-weight: 600;
    color: #64748b;
    background-color: rgba(255, 255, 255, 0.9);
    padding: 2px 6px;
    border-radius: 4px;
    pointer-events: none;
    white-space: nowrap;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    z-index: 14;
}

.connection_line {
    fill: none;
    stroke: #2563eb;
    stroke-width: 2.5;
    pointer-events: stroke;
    cursor: pointer;
}

.connection_line:hover {
    stroke: #1d4ed8;
    stroke-width: 3.5;
    filter: drop-shadow(0 2px 4px rgba(37, 99, 235, 0.4));
}

.connection_arrow {
    fill: #2563eb;
}

.temp_connection {
    fill: none;
    stroke-width: 3;
    stroke-linecap: round;
    pointer-events: none;
    filter: drop-shadow(0 2px 6px rgba(37, 99, 235, 0.3));
}

.temp_connection_circle {
    pointer-events: none;
    filter: drop-shadow(0 2px 4px rgba(37, 99, 235, 0.5));
    animation: circle_pulse 1s ease-in-out infinite;
}

@keyframes circle_pulse {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.7;
        transform: scale(1.3);
    }
}

.delete_button {
    position: absolute;
    top: -10px;
    right: -10px;
    width: 24px;
    height: 24px;
    background-color: #ef4444;
    color: #ffffff;
    border: 2px solid #ffffff;
    border-radius: 50%;
    display: none;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 14px;
    font-weight: bold;
    z-index: 20;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    transition: all 0.2s ease;
}

.flow_node:hover .delete_button {
    display: flex;
}

.delete_button:hover {
    background-color: #dc2626;
    transform: scale(1.15);
}

.config_modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 1000;
    display: none;
    align-items: center;
    justify-content: center;
}

.config_modal_overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
}

.config_modal_content {
    position: relative;
    width: 90%;
    max-width: 900px;
    max-height: 85vh;
    background-color: #ffffff;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.config_modal_header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 24px 28px;
    border-bottom: 1px solid #e2e8f0;
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: #ffffff;
}

.config_modal_header h3 {
    font-size: 22px;
    font-weight: 700;
}

.config_modal_close {
    width: 36px;
    height: 36px;
    background-color: rgba(255, 255, 255, 0.2);
    border: none;
    border-radius: 50%;
    color: #ffffff;
    font-size: 24px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.config_modal_close:hover {
    background-color: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

.config_modal_body {
    padding: 28px;
    overflow-y: auto;
    flex: 1;
}

.types_grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
}

.type_card {
    padding: 20px;
    background-color: #f8fafc;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
}

.type_card:hover {
    background-color: #ffffff;
    border-color: #3b82f6;
    transform: translateY(-4px);
    box-shadow: 0 8px 16px rgba(59, 130, 246, 0.2);
}

.type_icon {
    font-size: 48px;
    margin-bottom: 12px;
}

.type_name {
    font-size: 16px;
    font-weight: 600;
    color: #1e293b;
    margin-bottom: 6px;
}

.type_description {
    font-size: 13px;
    color: #64748b;
    line-height: 1.4;
}

.outputs_info {
    margin-top: 8px;
    padding: 4px 8px;
    background-color: #dbeafe;
    color: #1e40af;
    font-size: 11px;
    font-weight: 600;
    border-radius: 4px;
}

.config_form {
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.back_to_types {
    padding: 10px 20px;
    background-color: #f1f5f9;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    color: #475569;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-bottom: 24px;
}

.back_to_types:hover {
    background-color: #e2e8f0;
}

.form_header {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 20px;
    border-radius: 12px;
    margin-bottom: 28px;
}

.form_icon {
    font-size: 48px;
}

.form_header h4 {
    font-size: 20px;
    font-weight: 700;
    color: #1e293b;
    margin-bottom: 4px;
}

.form_header p {
    font-size: 14px;
    color: #64748b;
}

.form_fields {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin-bottom: 28px;
}

.field_group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.field_label {
    font-size: 14px;
    font-weight: 600;
    color: #1e293b;
}

.field_input {
    padding: 12px 16px;
    background-color: #ffffff;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 14px;
    color: #1e293b;
    transition: all 0.2s ease;
    font-family: inherit;
}

.field_input:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.checkbox_label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
}

.field_checkbox {
    width: 20px;
    height: 20px;
    cursor: pointer;
}

.save_config {
    width: 100%;
    padding: 14px 24px;
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    border: none;
    border-radius: 10px;
    color: #ffffff;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.save_config:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(59, 130, 246, 0.4);
}

.save_config:active {
    transform: translateY(0);
}

.dynamic_cases_container,
.dynamic_ranges_container {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 12px;
}

.case_item,
.range_item,
.kv_item {
    display: flex;
    gap: 8px;
    align-items: center;
}

.case_value,
.range_min,
.range_max,
.range_label,
.kv_key,
.kv_value {
    flex: 1;
    padding: 8px 12px;
    background-color: #ffffff;
    border: 2px solid #e2e8f0;
    border-radius: 6px;
    font-size: 13px;
    color: #1e293b;
    transition: all 0.2s ease;
}

.case_value:focus,
.range_min:focus,
.range_max:focus,
.range_label:focus,
.kv_key:focus,
.kv_value:focus {
    outline: none;
    border-color: #f59e0b;
    box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.1);
}

.remove_case,
.remove_range,
.remove_kv {
    width: 28px;
    height: 28px;
    background-color: #ef4444;
    border: none;
    border-radius: 6px;
    color: #ffffff;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.remove_case:hover,
.remove_range:hover,
.remove_kv:hover {
    background-color: #dc2626;
    transform: scale(1.1);
}

.add_case_button,
.add_range_button {
    padding: 8px 16px;
    background-color: #f59e0b;
    border: none;
    border-radius: 6px;
    color: #ffffff;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    align-self: flex-start;
}

.add_case_button:hover,
.add_range_button:hover {
    background-color: #d97706;
    transform: translateY(-1px);
}