.flow-lab-banner code {
	font-size: 0.78em;
}

/* Maximize Flows workspace under top chrome */
#panel-flows.active {
	display: flex;
	flex-direction: column;
	min-height: calc(100vh - 118px);
}

#panel-flows .flow-lab-banner {
	flex: 0 0 auto;
}

.layout-flows {
	flex: 1 1 auto;
	display: grid;
	grid-template-columns: minmax(180px, 220px) minmax(0, 1fr) minmax(260px, 300px);
	align-items: stretch;
	gap: 0.85rem;
	min-height: 0;
	height: calc(100vh - 168px);
	max-height: calc(100vh - 168px);
}

@media (max-width: 1100px) {
	.layout-flows {
		grid-template-columns: 1fr;
		height: auto;
		max-height: none;
	}

	.flow-canvas-wrap {
		min-height: 70vh;
	}
}

.flow-list-pane {
	min-height: 0;
	overflow: auto;
}

.flow-list-actions {
	display: flex;
	flex-direction: column;
	gap: 0.4rem;
	padding: 0.65rem 0.85rem 0.9rem;
}

.flow-canvas-wrap {
	display: flex;
	flex-direction: column;
	min-height: 0;
	height: 100%;
	padding: 0;
	overflow: hidden;
}

.flow-toolbar {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 0.45rem;
	padding: 0.55rem 0.75rem;
	border-bottom: 1px solid var(--q88-color-line);
	background: rgba(0, 0, 0, 0.2);
	flex: 0 0 auto;
}

.flow-toolbar input[type='text'] {
	min-width: 140px;
	flex: 1 1 140px;
}

.flow-toolbar select {
	max-width: 140px;
}

.flow-zoombar {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 0.4rem;
	padding: 0.4rem 0.75rem;
	border-bottom: 1px solid var(--q88-color-line);
	background: rgba(0, 0, 0, 0.12);
	flex: 0 0 auto;
}

.flow-zoom-label {
	min-width: 3.2rem;
	text-align: center;
	font-size: 0.8rem;
	font-variant-numeric: tabular-nums;
	opacity: 0.9;
}

.flow-zoom-hint {
	font-size: 0.72rem;
	margin-left: 0.35rem;
}

.flow-errors {
	flex: 0 0 auto;
	max-height: 7.5rem;
	overflow: auto;
	padding: 0.45rem 0.75rem;
	border-bottom: 1px solid var(--q88-color-line);
	background: rgba(40, 12, 12, 0.55);
	font-size: 0.78rem;
	line-height: 1.4;
}

.flow-errors[hidden] {
	display: none !important;
}

.flow-errors .flow-err {
	color: #ffb4b4;
	margin: 0.15rem 0;
}

.flow-errors .flow-warn {
	color: #e6c97a;
	margin: 0.15rem 0;
}

.flow-errors .flow-ok {
	color: #9dffa8;
	margin: 0.15rem 0;
}

.flow-canvas {
	position: relative;
	flex: 1 1 auto;
	min-height: 0;
	overflow: auto;
	background:
		radial-gradient(circle at 1px 1px, rgba(255, 255, 255, 0.06) 1px, transparent 0) 0 0 / 18px 18px,
		linear-gradient(160deg, #12151a, #0c0e12 60%);
	cursor: grab;
	overscroll-behavior: contain;
}

.flow-canvas:active,
.flow-canvas.is-panning {
	cursor: grabbing;
}

/* Drives scrollable overflow; scale() alone does not enlarge layout size */
.flow-world-sizer {
	position: relative;
	min-width: 100%;
	min-height: 100%;
}

.flow-world {
	position: absolute;
	top: 0;
	left: 0;
	transform-origin: 0 0;
	will-change: transform;
}

.flow-edges {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	pointer-events: none;
	overflow: visible;
}

.flow-edges .flow-edge-hit {
	fill: none;
	stroke: transparent;
	stroke-width: 14;
	pointer-events: stroke;
	cursor: pointer;
}

.flow-edges .flow-edge-line {
	fill: none;
	stroke: rgba(176, 149, 96, 0.55);
	stroke-width: 2;
	pointer-events: none;
}

.flow-edges .flow-edge-line.selected {
	stroke: #f0a0a0;
	stroke-width: 3;
	filter: drop-shadow(0 0 4px rgba(240, 160, 160, 0.45));
}

.flow-edges .flow-edge-draft {
	fill: none;
	stroke: #5aa8e8;
	stroke-width: 2.5;
	stroke-dasharray: 7 5;
	pointer-events: none;
}

.flow-edges .flow-edge-label-bg {
	fill: #161a22;
	stroke: rgba(176, 149, 96, 0.35);
	stroke-width: 1;
}

.flow-edges text {
	fill: #e2d4b0;
	font-size: 12px;
	font-family: Montserrat, system-ui, sans-serif;
	letter-spacing: 0.04em;
	font-weight: 500;
	pointer-events: none;
}

.flow-nodes {
	position: absolute;
	inset: 0;
	min-width: 1200px;
	min-height: 700px;
}

.flow-edit-hint {
	font-size: 0.75rem;
	line-height: 1.35;
	margin: 0 0 0.65rem;
	flex: 0 0 auto;
}

.flow-side {
	display: flex;
	flex-direction: column;
	gap: 0.75rem;
	min-height: 0;
	height: 100%;
}

.flow-inspector {
	flex: 1 1 auto;
	min-height: 0;
	display: flex;
	flex-direction: column;
	overflow: hidden;
}

.flow-inspector .section-mark {
	flex: 0 0 auto;
}

.flow-inspector-scroll {
	flex: 1 1 auto;
	min-height: 0;
	overflow: auto;
	padding-right: 0.15rem;
}

.flow-preview {
	flex: 0 0 auto;
	max-height: 280px;
	overflow: hidden;
}

.flow-node {
	position: absolute;
	width: 248px;
	padding: 0;
	border-radius: 10px;
	border: 2px solid #4a5568;
	background: #141820;
	box-shadow: 0 10px 28px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.04);
	cursor: move;
	user-select: none;
	z-index: 2;
}

.flow-node.selected {
	border-color: var(--q88-color-goldLight);
	box-shadow: 0 0 0 2px rgba(176, 149, 96, 0.35), 0 12px 32px rgba(0, 0, 0, 0.5);
}

.flow-node.has-error {
	border-color: #e07070;
	box-shadow: 0 0 0 2px rgba(224, 112, 112, 0.35);
}

.flow-node.has-warn:not(.has-error) {
	border-color: #c9a227;
}

.flow-node-head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 0.35rem;
	padding: 0.4rem 0.65rem;
	border-bottom: 1px solid rgba(255, 255, 255, 0.08);
	border-radius: 8px 8px 0 0;
	font-size: 0.68rem;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	font-weight: 600;
}

.flow-node-ports-meta {
	opacity: 0.85;
	font-variant-numeric: tabular-nums;
	letter-spacing: 0.04em;
	text-transform: none;
	font-size: 0.68rem;
}

.flow-node-body {
	padding: 0.55rem 0.7rem 0.65rem;
}

.flow-node-title {
	font-size: 0.92rem;
	font-weight: 600;
	margin: 0 0 0.35rem;
	line-height: 1.35;
	letter-spacing: 0.02em;
	word-break: break-word;
}

.flow-node-meta {
	font-size: 0.74rem;
	opacity: 0.75;
	line-height: 1.45;
	letter-spacing: 0.02em;
	word-break: break-word;
	margin: 0;
}

.flow-node-ports {
	display: flex;
	justify-content: space-between;
	gap: 0.5rem;
	padding: 0.35rem 0.45rem 0.55rem;
	border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.flow-ports-col {
	display: flex;
	flex-direction: column;
	gap: 0.35rem;
	min-width: 0;
	flex: 1;
}

.flow-ports-col.outs {
	align-items: flex-end;
}

.flow-ports-col.ins {
	align-items: flex-start;
}

.flow-port {
	display: inline-flex;
	align-items: center;
	gap: 0.35rem;
	max-width: 100%;
	padding: 0.2rem 0.35rem;
	border-radius: 999px;
	border: 1px solid transparent;
	font-size: 0.68rem;
	line-height: 1.2;
	cursor: crosshair;
	background: rgba(255, 255, 255, 0.03);
}

.flow-port .dot {
	width: 10px;
	height: 10px;
	border-radius: 50%;
	flex: 0 0 auto;
	box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.35);
}

.flow-port.in .dot {
	background: #3ecf8e;
	box-shadow: 0 0 0 2px rgba(62, 207, 142, 0.35);
}

.flow-port.out .dot {
	background: #5aa8e8;
	box-shadow: 0 0 0 2px rgba(90, 168, 232, 0.4);
}

.flow-port.out.linked .dot {
	background: #8fd0ff;
}

.flow-port.url {
	cursor: default;
	opacity: 0.75;
}

.flow-port.url .dot {
	background: #b09560;
	box-shadow: 0 0 0 2px rgba(176, 149, 96, 0.35);
}

.flow-port .port-label {
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
	max-width: 88px;
}

.flow-port.linking {
	border-color: rgba(90, 168, 232, 0.8);
	background: rgba(90, 168, 232, 0.15);
}

.flow-port.accept {
	border-color: rgba(62, 207, 142, 0.8);
	background: rgba(62, 207, 142, 0.12);
}

.flow-node[data-type='start'] .flow-node-head {
	background: rgba(90, 160, 220, 0.22);
	color: #9ec9ef;
}

.flow-node[data-type='message'] .flow-node-head {
	background: rgba(176, 149, 96, 0.2);
	color: #e2d4b0;
}

.flow-node[data-type='condition'] .flow-node-head {
	background: rgba(200, 140, 60, 0.22);
	color: #f0c090;
}

.flow-node[data-type='geo_map'] .flow-node-head {
	background: rgba(120, 160, 220, 0.25);
	color: #b8d4f0;
}

.flow-node[data-type='geo_map'] {
	border-color: rgba(120, 160, 220, 0.75);
}

.flow-node[data-type='delay'] .flow-node-head {
	background: rgba(90, 160, 120, 0.22);
	color: #a8d8b8;
}

.flow-node[data-type='end'] .flow-node-head {
	background: rgba(120, 120, 130, 0.28);
	color: #c8c8d0;
}

.flow-node[data-type='start'] {
	border-color: rgba(90, 160, 220, 0.75);
}

.flow-node[data-type='message'] {
	border-color: rgba(176, 149, 96, 0.65);
}

.flow-node[data-type='condition'] {
	border-color: rgba(200, 140, 60, 0.7);
}

.flow-node[data-type='delay'] {
	border-color: rgba(120, 160, 120, 0.7);
}

.flow-node[data-type='end'] {
	border-color: rgba(140, 140, 150, 0.7);
}

.flow-inspector label {
	display: block;
	margin-bottom: 0.55rem;
	font-size: 0.8rem;
}

.flow-inspector input,
.flow-inspector select,
.flow-inspector textarea {
	width: 100%;
	margin-top: 0.25rem;
}

.flow-inspector textarea {
	min-height: 90px;
	max-height: 160px;
	resize: vertical;
}

.flow-btn-row {
	display: grid;
	grid-template-columns: 1fr;
	gap: 0.45rem;
	padding: 0.5rem;
	margin-bottom: 0.45rem;
	border: 1px solid var(--q88-color-line);
	border-radius: 6px;
	background: rgba(0, 0, 0, 0.18);
}

.flow-preview .phone-sm {
	margin: 0 auto;
	transform: scale(0.85);
	transform-origin: top center;
	max-height: 200px;
}

.flow-preview .phone-chat {
	max-height: 140px;
	overflow: auto;
}

.flow-preview-hint {
	font-size: 0.75rem;
	margin-top: 0.35rem;
}

.flow-chip {
	display: inline-block;
	padding: 0.12rem 0.4rem;
	border-radius: 999px;
	font-size: 0.68rem;
	margin-left: 0.35rem;
}

.flow-preview .tg-btns {
	display: flex;
	flex-direction: column;
	gap: 0.35rem;
	margin-top: 0.5rem;
}

.flow-preview .tg-btn {
	display: block;
	width: 100%;
	padding: 0.4rem 0.55rem;
	border-radius: 6px;
	border: 1px solid rgba(90, 160, 220, 0.45);
	background: rgba(90, 160, 220, 0.12);
	color: #9ec9ef;
	font-size: 0.78rem;
}
