/* Flow Manager (read-only preview) + source-driven run modal (source-run.md §4).
   Replaces the old Flow Builder canvas stylesheet — no canvas / node / port
   rules anymore, only the read-only catalog UI and the run target cards. */

.fm-modal {
  width: min(94vw, 1250px) !important;
  height: min(86vh, 760px) !important;
  max-width: none !important;
  max-height: min(86vh, 760px) !important;
  display: flex;
  flex-direction: column;
  padding: 0 !important;
}
.fm-modal .modal-h { flex: 0 0 auto; border-bottom: 1px solid var(--bd, rgba(128,128,128,.2)); }
.fm-sub {
  font-size: .68rem;
  color: var(--fg3, #999);
  margin-left: 16px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.fm-layout {
  flex: 1 1 auto;
  min-height: 0;
  display: grid;
  grid-template-columns: 200px 300px 1fr;
}
.fm-side { display: flex; flex-direction: column; min-height: 0; border-right: 1px solid var(--bd, rgba(128,128,128,.2)); }
.fm-col  { display: flex; flex-direction: column; min-height: 0; border-right: 1px solid var(--bd, rgba(128,128,128,.2)); }
.fm-side-lbl {
  font-size: .66rem; text-transform: uppercase; letter-spacing: .08em;
  color: var(--fg3, #999); padding: 10px 12px 6px; flex: 0 0 auto;
}
.fm-groups { overflow-y: auto; flex: 1 1 auto; padding: 0 8px 10px; min-height: 0; }
.fm-flows { overflow-y: auto; flex: 1 1 auto; padding: 0 8px 10px; min-height: 0; }
.fm-preview { overflow-y: auto; flex: 1 1 auto; padding: 10px 12px; min-height: 0; }

.fm-group {
  display: flex; align-items: center; gap: 8px;
  width: 100%; text-align: left;
  background: transparent; color: var(--fg, #eee);
  border: 1px solid var(--bd, rgba(128,128,128,.25));
  border-radius: 8px; padding: 8px 10px; margin-bottom: 6px; cursor: pointer;
}
.fm-group:hover { border-color: var(--acc2, #4c9aff); background: rgba(76,154,255,.06); }
.fm-group.sel { border-color: var(--acc2, #4c9aff); background: rgba(76,154,255,.08); }
.fm-group .fm-g-ic { width: 20px; height: 20px; flex: none; }
.fm-group .fm-g-ic img { width: 100%; height: 100%; object-fit: contain; }
.fm-group b { display: block; font-size: .76rem; line-height: 1.2; }
.fm-group span { display: block; font-size: .62rem; color: var(--fg3, #999); }

.fm-card {
  display: block; width: 100%; text-align: left;
  background: rgba(128,128,128,.07); color: var(--fg, #eee);
  border: 1px solid var(--bd, rgba(128,128,128,.3));
  border-radius: 8px; padding: 8px 10px; margin-bottom: 6px; cursor: pointer;
  font-size: .72rem;
}
.fm-card:hover { border-color: var(--acc2, #4c9aff); background: rgba(76,154,255,.08); }
.fm-card.sel { border-color: var(--acc2, #4c9aff); background: rgba(76,154,255,.1); }
.fm-card b { display: block; font-size: .74rem; }
.fm-card .fm-meta { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; margin-top: 4px; font-size: .62rem; color: var(--fg3, #999); }
.fm-card .fm-tag { border: 1px solid var(--bd, rgba(128,128,128,.3)); border-radius: 4px; padding: 0 5px; }
.fm-card .fm-desc { font-size: .64rem; color: var(--fg3, #999); margin-top: 3px; }

.fm-preview .fm-p-title { font-size: .85rem; font-weight: 600; margin-bottom: 2px; }
.fm-preview .fm-p-sub { font-size: .68rem; color: var(--fg3, #999); margin-bottom: 10px; }
.fm-preview .mermaid { display: flex; justify-content: center; margin: 6px 0 14px; overflow: auto; max-height: 350px; }
.fm-preview pre.fm-src {
  background: rgba(0,0,0,.35); border: 1px solid var(--bd, rgba(128,128,128,.2));
  border-radius: 6px; padding: 8px 10px; font-size: .62rem; overflow: auto;
  color: var(--fg2, #cfd4e0); max-height: 200px; margin: 0 0 12px;
}
.fm-steps { list-style: none; margin: 0; padding: 0; }
.fm-steps li {
  display: flex; gap: 8px; align-items: baseline;
  font-size: .68rem; padding: 2px 0; color: var(--fg2, #cfd4e0);
}
.fm-steps li .fm-n { color: var(--fg3, #999); font-family: var(--mono, monospace); flex: none; }
.fm-steps li .fm-flag { color: var(--acc2, #4c9aff); font-size: .6rem; flex: none; }

/* ── source-run modal target cards ──
   Compact logo|platform tiles (source-run.md §4.3-§4.4). The checkbox is
   visually hidden — the whole <label> tile toggles selection and the tick
   shows the picked state. All selectors stay scoped under .run-cards: the
   cards are <label>s inside a modal .f block, and the generic `.f label`
   rule (display:block, uppercase) would otherwise outrank a bare class. */
.run-cards { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.run-cards .run-card {
  position: relative;
  display: flex; align-items: center; gap: 8px;
  margin: 0; padding: 8px 12px;
  text-transform: none; letter-spacing: normal;
  font-size: .78rem; text-align: left;
  background: rgba(128,128,128,.05); color: var(--fg, #eee);
  border: 1px solid var(--bd, rgba(128,128,128,.28));
  border-radius: 9px; cursor: pointer;
  transition: border-color var(--tr, .18s), background-color var(--tr, .18s), box-shadow var(--tr, .18s);
}
.run-cards .run-card:hover { border-color: var(--acc2, #4c9aff); background: rgba(99,102,241,.06); }
.run-cards .run-card:has(input:checked) {
  border-color: var(--acc2, #4c9aff);
  background: rgba(99, 102, 241, .09);
  box-shadow: inset 0 0 0 1px rgba(99, 102, 241, .18);
}
.run-cards .run-card:has(input:disabled) { opacity: .55; cursor: default; }
.run-cards .run-card:has(input:disabled):hover { border-color: var(--bd, rgba(128,128,128,.28)); background: rgba(128,128,128,.05); }
/* Hidden checkbox: the tile itself is the toggle. */
.run-cards .run-card input[type=checkbox] {
  position: absolute; opacity: 0; width: 0; height: 0; margin: 0; pointer-events: none;
}
.run-cards .run-card .rc-logo { width: 20px; height: 20px; flex: none; display: inline-flex; }
.run-cards .run-card .rc-logo img { width: 100%; height: 100%; object-fit: contain; }
.run-cards .run-card .rc-name { flex: 1 1 auto; min-width: 0; font-weight: 600; font-size: .76rem; line-height: 1.2; }
/* Selection tick — hollow ring by default, accent dot/check when picked. */
.run-cards .run-card .rc-tick {
  width: 15px; height: 15px; flex: none; border-radius: 50%;
  border: 1.5px solid var(--bd, rgba(128,128,128,.4));
  box-sizing: border-box;
  transition: background-color var(--tr, .18s), border-color var(--tr, .18s);
}
.run-cards .run-card:has(input:checked) .rc-tick {
  border-color: var(--acc2, #818cf8);
  background: var(--acc2, #818cf8);
  box-shadow: inset 0 0 0 3px rgba(15,17,26,.9);
}
.run-cards .run-card .rc-state {
  font-size: .6rem; font-weight: 600; text-transform: uppercase;
  letter-spacing: .4px; color: var(--fg3, #999); flex: none;
}
.run-dim { font-size: .64rem; color: var(--fg3, #999); font-weight: 400; margin-left: 6px; }

@media (max-width: 1100px) {
  .fm-layout { grid-template-columns: 170px 260px 1fr; }
  .fm-layout-inline { grid-template-columns: 150px 220px 1fr; }
  .fm-sub { display: none; }
}

/* Flow layout inline (inside config-hub sidebar content) */
.fm-layout-inline .fm-side,
.fm-layout-inline .fm-col {
  border-right: 1px solid var(--bd, rgba(128,128,128,.2));
}
.fm-layout-inline .fm-preview-col {
  overflow-y: auto;
  padding: 10px 12px;
  max-height: 450px;
}
