/* LibreFlow — style.css */
:root {
  --bg: #f4f6fb;
  --panel: #ffffff;
  --topbar: #1b2233;
  --topbar-2: #232c42;
  --ink: #1b2233;
  --muted: #64748b;
  --line: #e2e8f0;
  --accent: #2563eb;
  --accent-soft: #dbeafe;
  --danger: #dc2626;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(15, 23, 42, 0.06), 0 6px 20px rgba(15, 23, 42, 0.05);
  font-family: -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--ink);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

/* ---------- top bar ---------- */
.topbar {
  display: flex;
  align-items: center;
  gap: 18px;
  height: 52px;
  padding: 0 14px;
  background: linear-gradient(180deg, var(--topbar-2), var(--topbar));
  color: #eef2ff;
  flex: 0 0 auto;
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.25);
  z-index: 20;
}
.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; letter-spacing: 0.2px; }
.brand-mark {
  display: inline-flex; align-items: center; justify-content: center;
  width: 26px; height: 26px; border-radius: 7px;
  background: var(--accent); color: #fff; font-size: 15px;
}
.brand-name { font-size: 15px; }

.toolbar { display: flex; align-items: center; gap: 8px; flex: 1; }
.tool-group { display: flex; align-items: center; gap: 4px; }
.tool-sep { width: 1px; height: 22px; background: rgba(255, 255, 255, 0.14); margin: 0 4px; }
.tool-spacer { flex: 1; }

.tbtn {
  appearance: none; border: 0; cursor: pointer;
  background: rgba(255, 255, 255, 0.08);
  color: #e7ecf7;
  font-size: 13px; font-weight: 600;
  padding: 7px 11px; border-radius: 8px;
  min-width: 34px; height: 32px;
  transition: background 0.12s, transform 0.06s, opacity 0.12s;
}
.tbtn:hover { background: rgba(255, 255, 255, 0.18); }
.tbtn:active { transform: translateY(1px); }
.tbtn:disabled { opacity: 0.35; cursor: default; }
.tbtn.zoom-label { min-width: 52px; font-variant-numeric: tabular-nums; }
.tbtn.danger:hover { background: var(--danger); }

/* ---------- workspace ---------- */
.workspace { flex: 1; display: flex; min-height: 0; }

/* palette */
.palette {
  flex: 0 0 156px;
  background: var(--panel);
  border-right: 1px solid var(--line);
  display: flex; flex-direction: column;
  overflow-y: auto;
}
.palette-title, .inspector-title {
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.6px; color: var(--muted);
  padding: 14px 14px 8px;
}
.palette-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 8px;
  padding: 0 10px 10px;
}
.palette-item {
  display: flex; flex-direction: column; align-items: center; gap: 5px;
  background: #fbfcfe; border: 1px solid var(--line); border-radius: 9px;
  padding: 9px 4px 7px; cursor: grab; color: var(--muted);
  transition: border-color 0.12s, box-shadow 0.12s, transform 0.06s;
}
.palette-item:hover { border-color: var(--accent); box-shadow: var(--shadow); color: var(--ink); }
.palette-item:active { cursor: grabbing; transform: scale(0.97); }
.palette-icon { width: 42px; height: 34px; }
.palette-label { font-size: 10.5px; font-weight: 600; line-height: 1.1; text-align: center; }

.palette-hint {
  margin-top: auto; padding: 12px 14px;
  border-top: 1px solid var(--line);
  font-size: 11px; line-height: 1.5; color: var(--muted);
}
.palette-hint p { margin: 0 0 7px; }
.palette-hint strong { color: var(--ink); }

/* canvas */
.canvas-wrap { position: relative; flex: 1; min-width: 0; overflow: hidden; background: #fdfdff; }
.canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
.canvas:focus { outline: none; }
.canvas.pan-ready { cursor: grab; }
.canvas.panning { cursor: grabbing; }

.grid { pointer-events: none; }
.node { cursor: move; }
.node text { pointer-events: none; user-select: none; }
.node text .placeholder, text .placeholder { fill: #94a3b8; }
.shape-body { transition: filter 0.1s; }
.node.selected .shape-body { filter: drop-shadow(0 0 0.5px var(--accent)); }

.edge-line { pointer-events: none; }
.edge-hit { pointer-events: stroke; cursor: pointer; }
.edge-label-group { cursor: move; }
.edge-label-bg { pointer-events: all; }
.edge-label { pointer-events: none; }

.port { fill: #fff; stroke: var(--accent); stroke-width: 2; cursor: crosshair; }
.port:hover { fill: var(--accent); }
.port.active { fill: var(--accent); }

/* draggable connector endpoints */
.edge-endpoint { fill: #fff; stroke: var(--accent); stroke-width: 2; cursor: grab; }
.edge-endpoint:hover { fill: var(--accent-soft); }
.edge-endpoint.active { fill: var(--accent); cursor: grabbing; }
.edge.dragging { opacity: 0.25; }
.endpoint-preview { pointer-events: none; }

/* draggable connector bend segment */
.edge-mid-hit { stroke: transparent; fill: none; pointer-events: stroke; }
.edge-mid-hit[data-edge-mid="y"] { cursor: ns-resize; }
.edge-mid-hit[data-edge-mid="x"] { cursor: ew-resize; }
.edge-mid-grip { fill: #fff; stroke: var(--accent); stroke-width: 1.5; }
.edge-mid-grip.joined { fill: var(--accent); }
.edge-mid-grip.ns { cursor: ns-resize; }
.edge-mid-grip.ew { cursor: ew-resize; }
.handle { fill: #fff; stroke: var(--accent); stroke-width: 1.5; }
[data-handle="nw"], [data-handle="se"] { cursor: nwse-resize; }
[data-handle="ne"], [data-handle="sw"] { cursor: nesw-resize; }
[data-handle="n"], [data-handle="s"] { cursor: ns-resize; }
[data-handle="e"], [data-handle="w"] { cursor: ew-resize; }
.sel-box, .band, .connect-preview, .connect-target { pointer-events: none; }
.snap-guide { stroke: #f43f5e; pointer-events: none; shape-rendering: crispEdges; }

/* in-place text editor overlay */
.text-editor {
  position: absolute; display: none; z-index: 5;
  border: 2px solid var(--accent); border-radius: 6px;
  padding: 4px 6px; margin: 0; resize: none;
  font-family: inherit; line-height: 1.3; text-align: center;
  color: var(--ink); background: #fff;
  box-shadow: 0 4px 16px rgba(37, 99, 235, 0.25);
  outline: none; overflow: hidden;
}

/* empty hint */
.empty-hint {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  pointer-events: none;
}
.empty-hint-card {
  text-align: center; color: var(--muted);
  background: rgba(255, 255, 255, 0.7); border: 1px dashed var(--line);
  border-radius: 16px; padding: 28px 40px;
}
.empty-hint-icon {
  width: 48px; height: 48px; margin: 0 auto 10px;
  display: flex; align-items: center; justify-content: center;
  background: var(--accent-soft); color: var(--accent);
  border-radius: 12px; font-size: 24px;
}
.empty-hint h2 { margin: 0 0 4px; font-size: 17px; color: var(--ink); }
.empty-hint p { margin: 0; font-size: 13px; }

/* inspector */
.inspector {
  flex: 0 0 236px;
  background: var(--panel);
  border-left: 1px solid var(--line);
  overflow-y: auto;
}
.inspector-body { padding: 4px 14px 16px; }
.insp-row { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.insp-row.col { flex-direction: column; align-items: stretch; gap: 6px; }
.insp-label { font-size: 11px; font-weight: 700; color: var(--muted); min-width: 52px; }
.insp-input {
  width: 100%; font-family: inherit; font-size: 13px; color: var(--ink);
  border: 1px solid var(--line); border-radius: 8px; padding: 7px 9px;
  resize: vertical; background: #fbfcfe;
}
.insp-input:focus { outline: none; border-color: var(--accent); background: #fff; }

.swatches { display: flex; flex-wrap: wrap; gap: 6px; }
.swatch {
  width: 22px; height: 22px; border-radius: 6px; cursor: pointer;
  border: 1px solid rgba(15, 23, 42, 0.12); padding: 0;
  transition: transform 0.08s, box-shadow 0.1s;
}
.swatch:hover { transform: scale(1.12); }
.swatch.active { box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--accent); }
.swatch.none {
  background: #fff;
  background-image: linear-gradient(45deg, transparent 44%, #ef4444 44%, #ef4444 56%, transparent 56%);
  border-color: #cbd5e1;
}
.swatch.custom {
  position: relative; overflow: hidden;
  display: inline-flex; align-items: center; justify-content: center;
  background: conic-gradient(from 0deg, #f00, #ff0, #0f0, #0ff, #00f, #f0f, #f00);
  border-color: #cbd5e1;
}
.swatch.custom input[type="color"] {
  position: absolute; inset: 0; width: 100%; height: 100%;
  margin: 0; padding: 0; border: none; opacity: 0; cursor: pointer;
}

.align-grid { display: flex; gap: 6px; flex-wrap: wrap; }
.align-btn {
  width: 36px; height: 30px; padding: 0;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--line); background: #fbfcfe; border-radius: 7px;
  color: #475569; cursor: pointer; transition: border-color 0.12s, color 0.12s;
}
.align-btn:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); }
.align-btn:disabled { opacity: 0.4; cursor: default; }
.align-btn svg { width: 18px; height: 18px; fill: currentColor; stroke: currentColor; stroke-width: 1.2; stroke-linejoin: round; }

.insp-note { font-size: 11px; color: var(--muted); line-height: 1.4; margin: -2px 0 2px; }
.lineup-row { display: flex; align-items: center; gap: 6px; margin-top: 6px; }
.lineup-label { flex: 1; font-size: 12px; color: var(--ink); }
.lineup-btn {
  appearance: none; cursor: pointer;
  border: 1px solid var(--line); background: #fbfcfe; color: var(--muted);
  font-family: inherit; font-size: 11.5px; font-weight: 600;
  padding: 5px 8px; border-radius: 7px;
}
.lineup-btn:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); }
.lineup-btn:disabled { opacity: 0.4; cursor: default; }

.segmented { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.segmented button {
  appearance: none; border: 0; background: #fbfcfe; cursor: pointer;
  font-family: inherit; font-size: 12px; font-weight: 600; color: var(--muted);
  padding: 6px 12px;
}
.segmented button.active { background: var(--accent); color: #fff; }

.insp-btn {
  flex: 1; appearance: none; cursor: pointer;
  border: 1px solid var(--line); background: #fbfcfe; color: var(--ink);
  font-family: inherit; font-size: 13px; font-weight: 600;
  padding: 8px; border-radius: 8px;
}
.insp-btn:hover { border-color: var(--accent); color: var(--accent); }
.insp-btn.bold-toggle { flex: 0 0 auto; width: 34px; font-weight: 800; font-size: 14px; }
.insp-btn.bold-toggle.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.insp-btn.danger:hover { border-color: var(--danger); color: var(--danger); background: #fff5f5; }

/* cloud bar (top-right: status + diagram name + profile/sign-in) */
.cloudbar { display: flex; align-items: center; gap: 8px; }
.cloud-status { font-size: 11px; color: #aeb8cc; font-weight: 600; min-width: 0; white-space: nowrap; }
.cloud-status.saving { color: #cdd6ea; }
.cloud-status.err { color: #fca5a5; }
.tbtn.cloud-name { max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tbtn.cloud-profile.avatar {
  width: 32px; min-width: 32px; height: 32px; padding: 0; border-radius: 50%;
  background: var(--accent); color: #fff; font-weight: 700;
}
.tbtn.cloud-profile.avatar:hover { background: #1d4ed8; }

/* dialogs */
.lf-dialog {
  border: 0; border-radius: 14px; padding: 22px; width: min(420px, 92vw);
  box-shadow: 0 24px 64px rgba(15, 23, 42, 0.3); color: var(--ink);
  font-family: inherit;
}
.lf-dialog::backdrop { background: rgba(15, 23, 42, 0.45); backdrop-filter: blur(2px); }
.lf-dialog h2 { margin: 0 0 4px; font-size: 18px; }
.dlg-sub { font-size: 13px; color: var(--muted); margin: 0 0 14px; }
.dlg-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 14px; }
.provider-btn {
  display: block; width: 100%; margin: 8px 0; padding: 11px 14px;
  border: 1px solid var(--line); border-radius: 10px; background: #fff;
  font-family: inherit; font-size: 14px; font-weight: 600; color: var(--ink); cursor: pointer;
}
.provider-btn:hover { border-color: var(--accent); background: #f8faff; }

.diagrams-list { display: flex; flex-direction: column; gap: 6px; max-height: 48vh; overflow-y: auto; }
.diagram-row { display: flex; align-items: stretch; gap: 6px; }
.diagram-row.current .diagram-open { border-color: var(--accent); background: var(--accent-soft); }
.diagram-open {
  flex: 1; display: flex; justify-content: space-between; align-items: center; gap: 10px;
  border: 1px solid var(--line); background: #fbfcfe; border-radius: 9px; padding: 9px 12px;
  cursor: pointer; font-family: inherit; text-align: left;
}
.diagram-open:hover { border-color: var(--accent); }
.diagram-name { font-size: 13.5px; font-weight: 600; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.diagram-when { font-size: 11px; color: var(--muted); flex: 0 0 auto; }
.diagram-del {
  flex: 0 0 auto; width: 34px; border: 1px solid var(--line); background: #fbfcfe;
  border-radius: 9px; cursor: pointer; color: var(--muted); font-size: 18px; line-height: 1;
}
.diagram-del:hover { border-color: var(--danger); color: var(--danger); background: #fff5f5; }
.signout-btn { margin-top: 10px; width: 100%; }
.insp-btn.danger { color: var(--danger); }
.insp-btn.danger:hover { border-color: var(--danger); background: #fff5f5; }

/* user management dialog */
.users-dialog { width: min(560px, 94vw); }
.users-list { display: flex; flex-direction: column; gap: 6px; max-height: 52vh; overflow-y: auto; margin-bottom: 12px; }
.user-row {
  display: grid; grid-template-columns: 1fr auto auto; align-items: center; gap: 10px;
  border: 1px solid var(--line); border-radius: 9px; padding: 8px 10px; background: #fbfcfe;
}
.user-row.inactive { opacity: 0.6; }
.user-main { display: flex; flex-direction: column; min-width: 0; }
.user-email { font-size: 13px; font-weight: 600; color: var(--ink); overflow: hidden; text-overflow: ellipsis; }
.user-name { font-size: 11px; color: var(--muted); }
.user-meta { font-size: 11px; color: var(--muted); margin-top: 3px; }
.user-ctrls { display: flex; align-items: center; gap: 8px; }
.urole { width: auto; padding: 5px 6px; font-size: 12px; }
.ubadge { font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.4px; padding: 3px 7px; border-radius: 20px; }
.ubadge-ok { background: #dcfce7; color: #166534; }
.ubadge-pending { background: #fef9c3; color: #854d0e; }
.ubadge-off { background: #e2e8f0; color: #475569; }
.ubadge-owner { background: #ede9fe; color: #6d28d9; }

.ui-dialog .insp-input { width: 100%; margin: 8px 0 2px; }

/* admin page */
body.admin-page { overflow: auto; display: block; height: auto; min-height: 100%; }
.admin-title { font-weight: 700; font-size: 14px; color: #cdd6ea; }
.admin-wrap { max-width: 880px; margin: 0 auto; padding: 26px 18px 56px; }
.stat-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 10px; margin-bottom: 24px; }
.stat-box { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 16px 12px; text-align: center; box-shadow: var(--shadow); }
.stat-val { font-size: 26px; font-weight: 800; color: var(--ink); font-variant-numeric: tabular-nums; }
.stat-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; color: var(--muted); margin-top: 4px; }
.admin-section { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 18px; box-shadow: var(--shadow); }
.admin-section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.admin-section-head h2 { margin: 0; font-size: 16px; color: var(--ink); }
.admin-section .users-add { border-top: 0; padding-top: 0; }
.admin-gate { max-width: 460px; margin: 72px auto; text-align: center; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 32px; box-shadow: var(--shadow); }
.admin-gate h2 { margin: 0 0 6px; }
.admin-gate a { color: var(--accent); }
@media (max-width: 760px) { .stat-grid { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 460px) { .stat-grid { grid-template-columns: repeat(2, 1fr); } }

/* share link */
.share-link-row { display: flex; gap: 8px; align-items: center; margin: 4px 0 2px; }
.share-link-row .insp-input { flex: 1; font-size: 12px; }

/* templates picker */
.templates-dialog { width: min(520px, 94vw); }
.templates-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 4px; }
.template-card {
  display: flex; flex-direction: column; gap: 4px; text-align: left; cursor: pointer;
  border: 1px solid var(--line); background: #fbfcfe; border-radius: 10px; padding: 12px 14px;
  font-family: inherit;
}
.template-card:hover { border-color: var(--accent); box-shadow: var(--shadow); }
.template-name { font-size: 14px; font-weight: 700; color: var(--ink); }
.template-desc { font-size: 12px; color: var(--muted); line-height: 1.35; }
.user-actions { display: flex; gap: 6px; }
.user-actions .insp-btn { padding: 6px 10px; font-size: 12px; }
.users-add { display: flex; gap: 6px; align-items: center; border-top: 1px solid var(--line); padding-top: 12px; }
.users-add .insp-input { flex: 1; }
.users-add #uAddRole { flex: 0 0 auto; width: auto; }

/* status bar */
.statusbar {
  flex: 0 0 auto; height: 28px;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 14px; background: var(--panel); border-top: 1px solid var(--line);
  font-size: 12px; color: var(--muted);
}
.status-saved { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; color: #16a34a; }
.status-saved::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.status-saved.saving { color: var(--muted); }

/* scrollbars */
.palette::-webkit-scrollbar, .inspector::-webkit-scrollbar { width: 8px; }
.palette::-webkit-scrollbar-thumb, .inspector::-webkit-scrollbar-thumb { background: #d8deea; border-radius: 8px; }

@media (max-width: 720px) {
  .inspector { display: none; }
  .palette { flex-basis: 116px; }
  .brand-name { display: none; }
}

/* ===================== Front-door landing ===================== */
.fl-landing {
  position: fixed; inset: 0; z-index: 1000;
  overflow-y: auto; overflow-x: hidden;
  background: linear-gradient(180deg, #f8fafc 0%, #eef2fb 55%, #e7edf9 100%);
  color: var(--ink);
}
/* signed-in visitors skip the landing (no flash); signed-out always see it */
html.lf-skip-landing .fl-landing { display: none !important; }
.fl-wrap { max-width: 1180px; margin: 0 auto; padding: 28px 28px 24px; }
.fl-top {
  display: grid; grid-template-columns: minmax(340px, 1fr) minmax(380px, 1.2fr);
  gap: 44px; align-items: center; min-height: calc(100vh - 80px);
}
.fl-hero { display: flex; flex-direction: column; align-items: flex-start; gap: 12px; }
.fl-brand { display: flex; align-items: center; gap: 8px; font-weight: 700; color: var(--accent); letter-spacing: 0.02em; }
.fl-brand-mark { display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; border-radius: 8px; background: var(--accent); color: #fff; font-size: 17px; }
.fl-headline { margin: 4px 0 0; font-size: 40px; line-height: 1.08; font-weight: 800; letter-spacing: -0.02em; color: var(--ink); }
.fl-sub { margin: 0; font-size: 16px; line-height: 1.55; color: var(--muted); max-width: 36ch; }
.fl-cta { margin-top: 8px; }
.fl-btn { font-family: inherit; cursor: pointer; border: 1px solid transparent; border-radius: 10px; font-weight: 600; display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.fl-btn-primary { padding: 14px 26px; font-size: 16px; background: var(--accent); color: #fff; box-shadow: 0 8px 22px rgba(37, 99, 235, 0.30); }
.fl-btn-primary:hover { background: #1d4ed8; box-shadow: 0 10px 28px rgba(37, 99, 235, 0.40); }
.fl-trust { list-style: none; margin: 14px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px 16px; }
.fl-trust li { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--muted); }
.fl-trust li::before { content: '\2713'; color: #16a34a; font-weight: 700; }

/* hero demo card + self-building flowchart */
.fl-demo-wrap { display: flex; justify-content: center; min-width: 0; }
.fl-demo { width: 100%; max-width: 380px; background: var(--panel); border: 1px solid var(--line); border-radius: 16px; box-shadow: 0 18px 50px rgba(15, 23, 42, 0.14); padding: 18px; }
.fl-svg { width: 100%; height: auto; display: block; }
.fl-node text { fill: var(--ink); font-size: 13px; font-weight: 600; text-anchor: middle; dominant-baseline: middle; }
.fl-node rect, .fl-node polygon { stroke-width: 2; }
.fl-node { opacity: 0; animation: flnode 7s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
.fl-edge { fill: none; stroke: #64748b; stroke-width: 2; stroke-dasharray: 240; stroke-dashoffset: 240; animation: fledge 7s ease-in-out infinite; }
.fl-elabel { opacity: 0; font-size: 11px; fill: var(--muted); font-weight: 600; text-anchor: middle; animation: fllabel 7s ease-in-out infinite; }
.fl-n1 { animation-delay: 0s; } .fl-e1 { animation-delay: .5s; }
.fl-n2 { animation-delay: .9s; } .fl-e2 { animation-delay: 1.4s; }
.fl-n3 { animation-delay: 1.8s; } .fl-e3 { animation-delay: 2.3s; } .fl-l3 { animation-delay: 2.5s; }
.fl-n4 { animation-delay: 2.7s; } .fl-e4 { animation-delay: 3.2s; } .fl-l4 { animation-delay: 3.4s; }
@keyframes flnode { 0% { opacity: 0; transform: scale(.8); } 5% { opacity: 1; transform: scale(1); } 90% { opacity: 1; transform: scale(1); } 100% { opacity: 0; transform: scale(.8); } }
@keyframes fledge { 0% { stroke-dashoffset: 240; opacity: 0; } 4% { opacity: 1; } 12% { stroke-dashoffset: 0; } 90% { stroke-dashoffset: 0; opacity: 1; } 100% { opacity: 0; } }
@keyframes fllabel { 0%, 8% { opacity: 0; } 14% { opacity: 1; } 90% { opacity: 1; } 100% { opacity: 0; } }
/* arrowheads are separate so they only appear AFTER their line finishes drawing */
.fl-arrow { fill: #64748b; opacity: 0; animation: flarrow 7s ease-in-out infinite; }
.fl-a1 { animation-delay: .5s; } .fl-a2 { animation-delay: 1.4s; } .fl-a3 { animation-delay: 2.3s; } .fl-a4 { animation-delay: 3.2s; }
@keyframes flarrow { 0%, 12% { opacity: 0; } 16% { opacity: 1; } 90% { opacity: 1; } 100% { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .fl-node, .fl-edge, .fl-elabel, .fl-arrow { animation: none; opacity: 1; stroke-dashoffset: 0; } }

/* sections */
.fl-section-title { margin: 0; text-align: center; font-size: 26px; font-weight: 700; color: var(--ink); letter-spacing: -0.01em; }
.fl-how { padding: 48px 0 8px; }
.fl-steps { margin-top: 26px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.fl-step { position: relative; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 24px 20px 20px; }
.fl-num { position: absolute; top: -14px; left: 20px; width: 28px; height: 28px; border-radius: 50%; background: var(--accent); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 14px; font-weight: 700; box-shadow: 0 2px 10px rgba(37, 99, 235, 0.4); }
.fl-step h3 { margin: 6px 0 6px; font-size: 16px; color: var(--ink); }
.fl-step p { margin: 0; font-size: 13.5px; line-height: 1.5; color: var(--muted); }

.fl-benefits { padding: 40px 0; display: flex; flex-direction: column; gap: 38px; }
.fl-benefit-row { display: grid; grid-template-columns: 1fr 1fr; gap: 38px; align-items: center; }
.fl-benefit-reverse .fl-benefit-text { order: 2; } .fl-benefit-reverse .fl-benefit-visual { order: 1; }
.fl-benefit-text, .fl-benefit-visual { min-width: 0; }
.fl-kicker { font-size: 12px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--accent); }
.fl-benefit-text h3 { margin: 8px 0 6px; font-size: 22px; line-height: 1.2; color: var(--ink); }
.fl-benefit-text p { margin: 0; font-size: 14.5px; line-height: 1.55; color: var(--muted); }
.fl-benefit-visual { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 22px; box-shadow: 0 10px 30px rgba(15, 23, 42, 0.08); display: flex; align-items: center; justify-content: center; min-height: 140px; }
.fl-benefit-visual svg { width: 100%; max-width: 300px; height: auto; }
.fl-badges { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }
.fl-badges span { font-size: 12px; font-weight: 600; padding: 6px 12px; border-radius: 8px; background: var(--accent-soft); color: var(--accent); }
.fl-badge-off { background: #dcfce7 !important; color: #15803d !important; }

.fl-final { margin: 44px 0 10px; padding: 42px 24px; text-align: center; background: linear-gradient(135deg, rgba(37, 99, 235, 0.10), rgba(79, 70, 229, 0.06)); border: 1px solid var(--line); border-radius: 18px; }
.fl-final h2 { margin: 0 0 6px; font-size: 26px; font-weight: 800; color: var(--ink); }
.fl-final p { margin: 0 0 18px; font-size: 14.5px; color: var(--muted); }
.fl-footer { text-align: center; font-size: 12px; color: var(--muted); padding: 18px 0 4px; }

@media (max-width: 900px) {
  .fl-top { grid-template-columns: 1fr; gap: 26px; min-height: 0; padding-top: 8px; }
  .fl-headline { font-size: 32px; }
  .fl-demo-wrap { order: -1; }
}
@media (max-width: 760px) {
  .fl-steps { grid-template-columns: 1fr; gap: 26px; }
  .fl-benefit-row, .fl-benefit-reverse { grid-template-columns: 1fr; gap: 16px; }
  .fl-benefit-reverse .fl-benefit-text, .fl-benefit-reverse .fl-benefit-visual { order: 0; }
  .fl-section-title { font-size: 22px; }
  .fl-benefit-text h3 { font-size: 19px; }
}
