/* Rawnaq Flow Chart — Org / Process */
.rawnaq-flow-chart {
    --fc-ink: #1e1b2e;
    --fc-muted: #6b6478;
    --fc-line: #e6e2f0;
    --fc-panel: #ffffff;
    --fc-indigo: #4338ca;
    --fc-violet: #7c3aed;
    --fc-amber: #fbbf24;
    --fc-amber-soft: #fef3c7;
    --fc-radius: 14px;
    --fc-node-w: 150px;
    position: relative;
    width: 100%;
    max-width: 100%;
    color: var(--fc-ink);
    font-family: inherit;
}

.rawnaq-flow-stage {
    position: relative;
    background: var(--fc-panel);
    border: 1px solid var(--fc-line);
    border-radius: 24px;
    padding: 40px 28px 36px;
    overflow: auto;
    min-height: 280px;
}

.rawnaq-flow-canvas-wrap {
    position: relative;
    margin: 0 auto;
}

.rawnaq-flow-connectors {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    overflow: visible;
}

.rawnaq-flow-connectors path {
    fill: none;
    stroke: var(--fc-line);
    stroke-width: 2.5;
    stroke-linecap: round;
    stroke-dasharray: var(--len, 1);
    stroke-dashoffset: var(--len, 1);
    transition: stroke-dashoffset 0.9s cubic-bezier(0.4, 0, 0.2, 1);
}

.rawnaq-flow-connectors path.lit {
    stroke-dashoffset: 0;
}

.rawnaq-flow-connectors path.accent {
    stroke: var(--fc-amber);
    stroke-width: 3;
}

.rawnaq-flow-connectors.path-dashed path {
    stroke-dasharray: 8 6;
}

.rawnaq-flow-connectors.path-dashed path.lit {
    animation: rawnaq-fc-dash 1.2s linear infinite;
}

@keyframes rawnaq-fc-dash {
    to { stroke-dashoffset: -28; }
}

.rawnaq-flow-canvas {
    position: relative;
    z-index: 2;
}

.rawnaq-flow-node {
    position: absolute;
    width: var(--fc-node-w);
    background: var(--fc-panel);
    border: 1.5px solid var(--fc-line);
    border-radius: var(--fc-radius);
    padding: 12px 14px;
    box-shadow: 0 2px 6px rgba(30, 27, 46, 0.04);
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease, opacity 0.35s ease;
    opacity: 0;
    transform: translateY(10px) scale(0.96);
    box-sizing: border-box;
    text-align: left;
    color: inherit;
    text-decoration: none;
    display: block;
}

.rawnaq-flow-node.show {
    opacity: 1;
    transform: translateY(0) scale(1);
}

.rawnaq-flow-node:hover,
.rawnaq-flow-node:focus-visible {
    border-color: var(--fc-indigo);
    box-shadow: 0 10px 24px rgba(67, 56, 202, 0.14);
    transform: translateY(-2px);
    outline: none;
}

.rawnaq-flow-node.is-root {
    background: linear-gradient(135deg, var(--fc-indigo), var(--fc-violet));
    border: none;
    color: #fff;
}

.rawnaq-flow-node.is-root .rawnaq-flow-role {
    color: rgba(255, 255, 255, 0.75);
}

.rawnaq-flow-node.is-decision {
    border-color: var(--fc-amber);
    background: var(--fc-amber-soft);
}

.rawnaq-flow-node.is-decision .rawnaq-flow-title {
    color: #92400e;
}

.rawnaq-flow-icon {
    width: 30px;
    height: 30px;
    border-radius: 9px;
    background: var(--fc-amber-soft);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 8px;
    font-size: 14px;
    color: #92400e;
    line-height: 1;
}

.rawnaq-flow-node.is-root .rawnaq-flow-icon {
    background: rgba(255, 255, 255, 0.18);
    color: #fff;
}

.rawnaq-flow-icon .dashicons {
    width: 1em;
    height: 1em;
    font-size: 16px;
    line-height: 1;
}

.rawnaq-flow-title {
    font-size: 13.5px;
    font-weight: 700;
    line-height: 1.3;
}

.rawnaq-flow-role {
    font-size: 11px;
    color: var(--fc-muted);
    margin-top: 2px;
}

.rawnaq-flow-detail {
    position: absolute;
    background: var(--fc-ink);
    color: #fff;
    padding: 14px 16px;
    border-radius: 12px;
    font-size: 12.5px;
    line-height: 1.5;
    width: 220px;
    max-width: calc(100% - 24px);
    z-index: 30;
    box-shadow: 0 16px 40px rgba(30, 27, 46, 0.25);
    opacity: 0;
    pointer-events: none;
    transform: translateY(6px);
    transition: opacity 0.18s ease, transform 0.18s ease;
}

.rawnaq-flow-detail.open {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

.rawnaq-flow-detail::before {
    content: "";
    position: absolute;
    top: -6px;
    left: 22px;
    width: 12px;
    height: 12px;
    background: var(--fc-ink);
    transform: rotate(45deg);
}

.rawnaq-flow-detail strong {
    color: var(--fc-amber);
    display: block;
    margin-bottom: 4px;
}

.rawnaq-flow-mobile {
    display: none;
    flex-direction: column;
    gap: 10px;
}

.rawnaq-flow-mobile-item {
    border: 1.5px solid var(--fc-line);
    border-radius: 12px;
    padding: 12px 14px;
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: inherit;
    background: #fff;
}

.rawnaq-flow-mobile-item.is-root {
    background: linear-gradient(135deg, var(--fc-indigo), var(--fc-violet));
    color: #fff;
    border: none;
}

.rawnaq-flow-mobile-item .dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--fc-amber);
    flex-shrink: 0;
}

.rawnaq-flow-mobile-item b {
    display: block;
    font-size: 13px;
}

.rawnaq-flow-mobile-item span {
    font-size: 11px;
    color: var(--fc-muted);
}

.rawnaq-flow-mobile-item.is-root span {
    color: rgba(255, 255, 255, 0.7);
}

.rawnaq-flow-mobile-item.indent-1 { margin-left: 18px; }
.rawnaq-flow-mobile-item.indent-2 { margin-left: 36px; }
.rawnaq-flow-mobile-item.indent-3 { margin-left: 54px; }

@media (max-width: 767px) {
    .rawnaq-flow-stage.is-responsive .rawnaq-flow-canvas-wrap {
        display: none;
    }
    .rawnaq-flow-stage.is-responsive .rawnaq-flow-mobile {
        display: flex;
    }
    .rawnaq-flow-stage {
        padding: 24px 16px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .rawnaq-flow-node,
    .rawnaq-flow-connectors path,
    .rawnaq-flow-detail {
        transition: none !important;
        animation: none !important;
    }
    .rawnaq-flow-node {
        opacity: 1;
        transform: none;
    }
    .rawnaq-flow-connectors path {
        stroke-dashoffset: 0;
    }
}
