/* S*FSM widget. Theme colors only; ruled rows, no cards. */

.w-demo {
  margin: 10px 0 8px;
  padding: 4px 0 8px;
  border-bottom: 1px solid var(--light-gray);
}
.w-demo:not(.w-ready)::before { content: "This demo needs JavaScript."; color: var(--gray); font-size: 0.9rem; }

.w-note { margin: 8px 0; font-size: 0.88rem; color: var(--dark-gray); max-width: 72ch; }
.w-mono { font-family: var(--code); font-size: 0.78rem; color: var(--gray); }
.w-big { margin: 8px 0; font-family: var(--heading); font-size: 1.02rem; max-width: 72ch; }
.w-big strong { color: var(--accent); font-size: 1.2rem; }

.w-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; margin: 10px 0; }
.w-btn {
  appearance: none; min-height: 38px; padding: 7px 14px;
  border: 1px solid var(--primary); background: var(--primary); color: var(--background);
  font: inherit; font-family: var(--heading); font-size: 0.88rem; font-weight: var(--semi-bold);
  cursor: pointer; border-radius: 0;
}
.w-btn:hover { background: transparent; color: var(--primary); }
.w-btn-quiet { background: transparent; color: var(--primary); }
.w-btn-quiet:hover { background: var(--primary); color: var(--background); }
.w-btn.running { background: transparent; color: var(--accent); border-color: var(--accent); }
.w-btn[disabled] { cursor: default; opacity: 0.55; }
.w-btn:focus-visible, .seg-option:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.seg { display: inline-flex; flex-wrap: wrap; border: 1px solid var(--light-gray); }
.seg-option {
  appearance: none; padding: 6px 10px; border: 0; border-right: 1px solid var(--light-gray);
  background: transparent; color: var(--text); font: inherit; font-family: var(--code); font-size: 0.78rem;
  cursor: pointer; border-radius: 0; min-height: 34px;
}
.seg-option:last-child { border-right: 0; }
.seg-option[aria-checked="true"] { background: var(--light-gray); color: var(--accent); }

.w-range { display: grid; grid-template-columns: 6.5rem minmax(0, 1fr) 3rem; align-items: center; gap: 4px 10px; margin: 6px 0; max-width: 520px; font-family: var(--code); font-size: 0.78rem; color: var(--gray); }
.w-range input[type="range"] { width: 100%; accent-color: var(--primary); }
.w-range output { text-align: right; color: var(--text); }

/* charts */
.sf-graph, .sf-trace-chart, .sf-cap-chart, .sf-cost-chart { display: block; width: 100%; max-width: 760px; height: auto; margin: 8px 0; overflow: visible; }
.c-grid { stroke: var(--light-gray); stroke-width: 1; }
.c-tick { fill: var(--gray); font-family: var(--code); font-size: 11px; }
.c-label { fill: var(--dark-gray); font-family: var(--code); font-size: 11px; }
.c-paper { stroke: var(--text); stroke-width: 2; stroke-dasharray: 2 3; }
.sf-avg { stroke: var(--accent); stroke-width: 2; }

/* state graphs */
.sf-edge { fill: none; stroke: var(--gray); stroke-width: 1.4; opacity: 0.75; }
.sf-edge.sf-edge-new { stroke: var(--accent); opacity: 1; stroke-width: 2; }
.sf-edge.sf-bad { stroke: var(--accent); opacity: 1; stroke-width: 2.2; stroke-dasharray: 5 3; }
.sf-arrowhead { fill: var(--gray); }
.sf-node { fill: var(--background); stroke: var(--primary); stroke-width: 2; }
.sf-node-name { fill: var(--text); font-family: var(--heading); font-weight: 600; }
.sf-node-code { fill: var(--primary); font-family: var(--code); font-size: 11px; letter-spacing: 0.03em; }
.sf-twin .sf-node { stroke-dasharray: 4 2; }
.sf-new .sf-node { stroke: var(--accent); stroke-width: 3; }
.sf-node-g.on .sf-node { fill: var(--accent); stroke: var(--accent); }
.sf-node-g.on .sf-node-name { fill: var(--background); }
.sf-elabel rect { fill: var(--background); stroke: var(--light-gray); }
.sf-elabel text { fill: var(--text); font-family: var(--code); font-size: 10.5px; }
.sf-elabel.sf-bad text { fill: var(--accent); font-weight: 700; }
.sf-elabel.sf-bad rect { stroke: var(--accent); }

/* bars */
.sf-bar-hw { fill: var(--primary); }
.sf-bar-hd { fill: var(--accent); }
.sf-cap-bin { fill: var(--gray); opacity: 0.6; }
.sf-cap-bal { fill: var(--primary); }
.sf-cap-oh { fill: var(--accent); }
.sf-cost-bar { fill: var(--primary); opacity: 0.8; }
.sf-readout { min-height: 4.2rem; }

/* tables */
.sf-table-wrap, .sf-tables { overflow-x: auto; max-width: 100%; }
.sf-table-wrap table, .sf-tables table { min-width: 420px; }
.sf-count-table td, .sf-cap-table td { font-family: var(--code); font-size: 0.8rem; text-align: right; }
.sf-count-table th[scope="row"] { text-align: left; font-weight: normal; }
.sf-cap-table tr.on td { color: var(--accent); font-weight: 700; }
.sf-tables td { font-family: var(--code); font-size: 0.8rem; }
.sf-table-wrap th, .sf-tables th { white-space: nowrap; }
