/* Flowchart Maker (flowchart.js). Loaded after tool.css.
   The chart itself is drawn on white paper in both themes, so what you see is what you download. */

/* ---------- the bar ---------- */
.fc-bar { gap: 8px 14px; padding: 8px 14px; }
.fc-bar-g { display: flex; align-items: center; gap: 4px; }
.fc-bar .tk-btn svg { width: 16px; height: 16px; }
.fc-ib { width: 30px; padding: 0; }
.fc-zoom { min-width: 60px; padding: 0 8px; font-variant-numeric: tabular-nums; }
.fc-sel { height: 28px; font-size: 12.5px; }
.fc-bar-end { margin-inline-start: auto; }
.fc-open { position: relative; overflow: hidden; }
.fc-open input { position: absolute; inset: 0; opacity: 0; cursor: pointer; font-size: 0; }
.fc-open:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- the work area: shapes, chart, panel ---------- */
.fc-main { display: flex; flex-direction: column; gap: 10px; overflow: hidden; padding: 12px; }
.fc-work { flex: 1; min-height: 0; display: grid; grid-template-columns: 150px minmax(0, 1fr) 320px; gap: 12px; }

.fc-pal { display: flex; flex-direction: column; gap: 8px; min-height: 0; }
.fc-pal-h { margin: 2px 2px 0; font-size: 12.5px; font-weight: 650; color: var(--text-2); }
.fc-palette { display: grid; gap: 3px; align-content: start; min-height: 0; overflow: auto; padding: 2px; }
.fc-shape { display: flex; align-items: center; gap: 8px; min-height: 36px; padding: 5px 8px; border: 1px solid transparent; border-radius: 8px; background: transparent; color: var(--text); font-size: 12.5px; line-height: 1.25; text-align: start; cursor: grab; touch-action: pan-y; user-select: none; }
.fc-shape:hover { border-color: var(--line-strong); background: var(--panel-2); }
.fc-shape:active { cursor: grabbing; }
.fc-shape svg { width: 36px; height: 26px; flex: none; }
.fc-connect { align-items: flex-start; font-size: 12px; line-height: 1.35; padding: 0 2px; }
.fc-connect input { flex: none; margin-top: 1px; }
.fc-ghost { position: fixed; left: 0; top: 0; z-index: 1000; opacity: 0.85; pointer-events: none; filter: drop-shadow(0 6px 14px rgba(0, 0, 0, 0.3)); }

.fc-board {
  position: relative;
  min-height: 0;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background-color: #ffffff;
  background-image: radial-gradient(circle, #cdd5e1 1.1px, transparent 1.4px);
  touch-action: none;
  outline: none;
  user-select: none;
  -webkit-user-select: none;
}
.fc-board:focus-visible { box-shadow: 0 0 0 3px var(--accent); }
.fc-board.no-grid { background-image: none; }
.fc-board.can-pan, .fc-board.can-pan .fc-node, .fc-board.can-pan .fc-edge { cursor: grab; }
.fc-board.is-panning, .fc-board.is-panning * { cursor: grabbing !important; }
.fc-board > svg { position: absolute; inset: 0; width: 100%; height: 100%; display: block; overflow: visible; }
.fc-node { cursor: move; }
.fc-edge { cursor: pointer; }
.fc-selbox { fill: none; stroke: #0b7ea3; pointer-events: none; }
.fc-handle { fill: #ffffff; stroke: #0b7ea3; }
.fc-handle[data-handle="nw"], .fc-handle[data-handle="se"] { cursor: nwse-resize; }
.fc-handle[data-handle="ne"], .fc-handle[data-handle="sw"] { cursor: nesw-resize; }
.fc-handle[data-handle="n"], .fc-handle[data-handle="s"] { cursor: ns-resize; }
.fc-handle[data-handle="e"], .fc-handle[data-handle="w"] { cursor: ew-resize; }
.fc-port { cursor: crosshair; }
.fc-port-dot { fill: #ffffff; stroke: #0b7ea3; }
.fc-port:hover .fc-port-dot { fill: #0b7ea3; }
.fc-edgesel { fill: none; stroke: rgba(11, 126, 163, 0.32); stroke-linecap: round; stroke-linejoin: round; pointer-events: none; }
.fc-band { fill: rgba(11, 126, 163, 0.08); stroke: #0b7ea3; pointer-events: none; }
.fc-target { fill: rgba(11, 126, 163, 0.06); stroke: #0b7ea3; pointer-events: none; }
.fc-temp { fill: none; stroke: #0b7ea3; pointer-events: none; }
.fc-temphead { fill: #0b7ea3; pointer-events: none; }
.fc-editor {
  position: absolute;
  z-index: 3;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 4px;
  outline: 1.5px solid rgba(11, 126, 163, 0.7);
  background: transparent;
  font-family: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, "Noto Sans Hebrew", "Noto Sans Arabic", sans-serif;
  text-align: center;
  resize: none;
  overflow: hidden;
  user-select: text;
  -webkit-user-select: text;
}
.fc-editor.is-label { background: #ffffff; }
.fc-empty { position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; gap: 6px; padding: 20px; text-align: center; color: #3c4a5e; pointer-events: none; }
.fc-empty-t { margin: 0; font-size: 18px; font-weight: 650; color: #1f2937; }
.fc-empty-d { margin: 0 0 8px; max-width: 34ch; font-size: 13.5px; line-height: 1.5; }
.fc-empty-b { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; pointer-events: auto; }

/* ---------- the panel ---------- */
.fc-side { display: flex; flex-direction: column; min-height: 0; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); }
.fc-tabs { display: flex; gap: 2px; padding: 6px; border-bottom: 1px solid var(--line); }
.fc-tabs [role="tab"] { flex: 1; height: 32px; padding: 0 8px; border: 0; border-radius: 7px; background: transparent; color: var(--text-2); font-size: 13px; font-weight: 600; cursor: pointer; }
.fc-tabs [role="tab"]:hover { color: var(--text); background: var(--hover); }
.fc-tabs [role="tab"][aria-selected="true"] { background: var(--raised-2); color: var(--text); }
:root[data-theme="light"] .fc-tabs [role="tab"][aria-selected="true"] { background: var(--raised); box-shadow: inset 0 -2px 0 var(--accent); }
.fc-panel { flex: 1; min-height: 0; overflow: auto; display: grid; gap: 12px; align-content: start; padding: 14px; }
.fc-panel > .tk-note, .fc-panel p { margin: 0; }
.fc-panel .tk-note { color: var(--text-2); }
.fc-h { margin: 0; font-size: 14px; font-weight: 650; }
.fc-h3 { margin: 0; font-size: 12.5px; font-weight: 650; color: var(--text-2); }
.fc-field { display: grid; gap: 5px; min-width: 0; }
.fc-field > label, .fc-swatches legend, .fc-fmt legend, .fc-group > legend { color: var(--text-2); font-size: 12.5px; }
.fc-in, .fc-text, .fc-num { width: 100%; padding: 0 10px; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--panel-2); color: var(--text); font: inherit; }
.fc-in, .fc-num { height: 34px; }
.fc-text { min-height: 64px; padding: 7px 10px; resize: vertical; line-height: 1.4; }
.fc-in:focus, .fc-text:focus, .fc-num:focus { outline: 0; border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.fc-color { width: 100%; height: 34px; padding: 2px 3px; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--panel-2); cursor: pointer; }
.fc-color::-webkit-color-swatch-wrapper { padding: 0; }
.fc-color::-webkit-color-swatch { border: 0; border-radius: 5px; }
.fc-color::-moz-color-swatch { border: 0; border-radius: 5px; }
.fc-panel .tk-select { width: 100%; max-width: none; }
.fc-two { display: grid; grid-template-columns: repeat(auto-fit, minmax(84px, 1fr)); gap: 10px; align-items: end; }
.fc-bold { min-height: 34px; }
.fc-swatches, .fc-fmt { display: grid; gap: 6px; margin: 0; padding: 0; border: 0; min-width: 0; }
.fc-swatches legend, .fc-fmt legend { padding: 0; margin-bottom: 6px; }
.fc-sw-row { display: flex; flex-wrap: wrap; gap: 6px; }
.fc-sw { position: relative; display: block; width: 28px; height: 28px; cursor: pointer; }
.fc-sw input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.fc-sw span:first-of-type { display: block; width: 100%; height: 100%; border: 2px solid var(--s); border-radius: 7px; background: var(--f); }
.fc-sw input:checked + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.fc-sw input:focus-visible + span { outline: 3px solid var(--accent); outline-offset: 2px; }
.fc-group { display: grid; gap: 10px; margin: 0; padding: 10px 12px 12px; border: 1px solid var(--line); border-radius: 10px; min-width: 0; }
.fc-group > legend { padding: 0 4px; }
.fc-arrows { display: grid; gap: 6px; margin: 0; padding: 0; list-style: none; }
.fc-arrows li { display: grid; gap: 4px; padding: 6px 8px; border-radius: 8px; background: var(--panel-2); }
.fc-arrow-t { font-size: 12.5px; overflow-wrap: anywhere; }
.fc-arrow-b { display: flex; gap: 4px; }
.fc-tag { display: inline-block; padding: 0 7px; border-radius: 999px; background: var(--raised); color: var(--text); font-size: 11.5px; font-weight: 600; }
.fc-row { display: flex; flex-wrap: wrap; gap: 8px; }
.fc-grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.fc-grid3 .tk-btn { padding: 0 4px; }
.fc-how { display: grid; gap: 6px; margin: 0; padding-inline-start: 18px; color: var(--text-2); font-size: 12.5px; line-height: 1.45; }
.fc-keys { display: grid; grid-template-columns: auto 1fr; gap: 6px 10px; margin: 0; font-size: 12.5px; line-height: 1.4; }
.fc-keys dt { font-weight: 600; white-space: nowrap; }
.fc-keys dd { margin: 0; color: var(--text-2); }
.fc-radio { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border: 1px solid var(--line); border-radius: 9px; background: var(--panel-2); font-size: 13px; cursor: pointer; }
.fc-radio:has(input:checked) { border-color: var(--accent); background: var(--info-bg); }
.fc-radio input { width: 16px; height: 16px; margin: 0; flex: none; accent-color: var(--accent); }
.fc-go { width: 100%; }
.fc-private { display: flex; align-items: center; gap: 8px; color: var(--text-2); font-size: 12px; }
.fc-private svg { width: 16px; height: 16px; color: var(--pass); }
.fc-steps { display: grid; gap: 6px; margin: 0; padding: 0; list-style: none; }
.fc-step { display: grid; gap: 1px; width: 100%; padding: 7px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel-2); color: var(--text); text-align: start; cursor: pointer; }
.fc-step:hover { border-color: var(--line-strong); }
.fc-step.is-sel { border-color: var(--accent); background: var(--info-bg); }
.fc-step-type { color: var(--text-2); font-size: 11.5px; font-weight: 600; }
.fc-step-text { font-size: 13px; overflow-wrap: anywhere; }
.fc-step-out { display: grid; gap: 2px; margin: 4px 0 0; padding-inline-start: 14px; list-style: none; }
.fc-step-arrow { width: 100%; padding: 3px 6px; border: 0; border-radius: 6px; background: transparent; color: var(--text-2); font-size: 12.5px; text-align: start; cursor: pointer; overflow-wrap: anywhere; }
.fc-step-arrow:hover { background: var(--hover); color: var(--text); }
.fc-step-arrow.is-sel { color: var(--accent); background: var(--info-bg); }

/* ---------- smaller windows ---------- */
@media (max-width: 1150px) {
  .fc-work { grid-template-columns: 132px minmax(0, 1fr) 286px; gap: 10px; }
}
@media (max-width: 900px) {
  .fc-main { display: block; overflow: auto; }
  .fc-work { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; }
  .fc-palette { display: flex; gap: 4px; overflow-x: auto; overflow-y: hidden; padding-bottom: 4px; }
  .fc-shape { flex: none; flex-direction: column; justify-content: center; gap: 3px; width: 78px; min-height: 64px; padding: 6px 4px; border-color: var(--line); background: var(--panel); font-size: 11.5px; text-align: center; touch-action: pan-x; }
  .fc-board { height: max(340px, 60vh); }
  .fc-side { min-height: 0; }
  .fc-panel { overflow: visible; }
  .fc-bar-end { margin-inline-start: 0; }
}
@media (max-width: 520px) {
  .fc-bar { padding: 8px 10px; }
  .fc-bar .tk-btn span:not(.tk-sr):not(#zoomLabel) { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  .fc-bar .tk-btn:not(.fc-zoom) { width: 32px; padding: 0; }
  .fc-main { padding: 10px; }
}
@media (forced-colors: active) {
  .fc-board { background: Canvas; }
  .fc-selbox, .fc-band, .fc-target, .fc-temp { stroke: Highlight; }
  .fc-sw input:checked + span { outline-color: Highlight; }
}
