/* FML Playground: a desktop-like page on the site's tokens (or tokens.css on its own). Everything is scoped to .fmlp. */
.fmlp {
  --good: var(--diff-add-ink); --bad: var(--diff-del-ink); --bad-bg: var(--diff-del-bg); --warn: #b07d1a;
  --s1: var(--accent); --s2: #c27a3a; --s3: var(--diff-add-ink); --s4: #8a5aa0;
  --s5: #2f8f8f; --s6: #b8466a; --s7: #7c8a2e; --s8: var(--faint);
  --chrome: var(--code-bg); --panel: var(--card); --sel: var(--accent-soft);
  --tabbar-h: 34px;
  color: var(--ink); font: 14px/1.45 var(--f-display);
  --f-num: var(--f-mono);
}
.fmlp * { box-sizing: border-box; }
.fmlp button, .fmlp input, .fmlp select, .fmlp textarea { font: inherit; color: inherit; }
.fmlp code, .fmlp pre, .fmlp kbd, .fmlp textarea, .fmlp .url input { font-family: var(--f-mono); }
.fmlp h1, .fmlp h2, .fmlp h3, .fmlp p, .fmlp figure, .fmlp table, .fmlp ul, .fmlp ol { max-width: none; }
.fmlp pre { margin: 0; }
.fmlp [hidden] { display: none !important; }

/* ------------------------------------------------------------ shell */
.fmlp.app { position: fixed; inset: 0; display: grid; grid-template-rows: auto auto minmax(0, 1fr) var(--tabbar-h); grid-template-columns: minmax(0, 1fr); background: var(--paper); }
.fmlp.app.loading { display: grid; place-items: center; color: var(--soft); font-style: italic; }
.fmlp .views { min-height: 0; height: 100%; min-width: 0; }
.fmlp .spacer { flex: 1; }

/* top bar: the mark, the model's name over the menu bar, the save status, Connect agent */
.fmlp .topbar { display: flex; align-items: center; gap: 10px; padding: 4px 12px 2px; padding-top: max(4px, env(safe-area-inset-top, 0px)); background: var(--chrome); min-width: 0; }
.fmlp .topbar .home { color: var(--soft); text-decoration: none; font-size: 16px; padding: 2px 6px; border-radius: 4px; }
.fmlp .topbar .home:hover { background: var(--card); color: var(--accent); }
.fmlp .mark { font: 600 13px var(--f-mono); color: var(--paper); background: var(--accent); padding: 9px 7px; border-radius: 6px; flex: none; align-self: center; }
.fmlp .title-stack { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.fmlp .model-name { align-self: flex-start; max-width: 100%; border: 1px solid transparent; background: transparent; padding: 1px 6px; margin-left: -1px; font: 600 15px/1.3 var(--f-display); letter-spacing: -0.01em; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; border-radius: 4px; }
.fmlp button.model-name:hover:not(:disabled) { border-color: var(--rule); background: var(--card); }
.fmlp input.model-name { width: min(420px, 100%); background: var(--card); border-color: var(--accent-dim); outline: none; }
.fmlp .menu-row { display: flex; align-items: center; gap: 10px; min-width: 0; }
.fmlp .menubar { display: flex; align-items: center; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.fmlp .menubar::-webkit-scrollbar { display: none; }
.fmlp .menu-title { border: 0; background: transparent; padding: 2px 8px; font: 400 13px var(--f-display); color: var(--ink); border-radius: 4px; white-space: nowrap; }
.fmlp .menu-title:hover:not(:disabled), .fmlp .menu-title.on { background: var(--sel); color: var(--accent); }
.fmlp .save-status { border: 0; background: transparent; padding: 2px 6px; font: 400 12px var(--f-display); color: var(--faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; max-width: 46ch; border-radius: 4px; }
.fmlp button.save-status:hover:not(:disabled) { color: var(--ink); background: var(--card); }
.fmlp .save-status.dirty, .fmlp .save-status.bad { color: var(--bad); font-weight: 600; }
.fmlp .save-status.dirty:hover:not(:disabled) { background: var(--bad-bg); color: var(--bad); }

/* menus */
.fmlp .menu-popup { position: fixed; z-index: 40; min-width: 230px; max-width: calc(100vw - 16px); max-height: calc(100vh - 16px); overflow-y: auto; padding: 4px; background: var(--card); color: var(--ink); border: 1px solid var(--rule); border-radius: 7px; box-shadow: 0 10px 28px rgba(0, 0, 0, 0.16), 0 2px 6px rgba(0, 0, 0, 0.08); outline: none; font: 13px var(--f-display); }
.fmlp .menu-item { display: grid; grid-template-columns: 18px minmax(0, 1fr) auto 12px; align-items: center; gap: 4px; padding: 5px 8px 5px 4px; border-radius: 4px; cursor: default; user-select: none; white-space: nowrap; }
.fmlp .menu-item .text { overflow: hidden; text-overflow: ellipsis; }
.fmlp .menu-item.active { background: var(--sel); color: var(--accent); }
.fmlp .menu-item.disabled { opacity: 0.42; }
.fmlp .menu-item .check { text-align: center; font-size: 11px; color: var(--accent); }
.fmlp .menu-item kbd { margin-left: 18px; font: 11.5px var(--f-mono); color: var(--soft); opacity: 1; }
.fmlp .menu-item .more { color: var(--soft); text-align: right; }
.fmlp .menu-sep { height: 1px; background: var(--rule); margin: 4px 6px; }
.fmlp .menu-heading { padding: 6px 8px 2px 26px; font: 600 10.5px var(--f-display); text-transform: uppercase; letter-spacing: 0.07em; color: var(--faint); }

/* toolbar */
.fmlp .toolbar-row { display: flex; align-items: center; gap: 2px; padding: 3px 10px; border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule); background: var(--paper); min-width: 0; overflow-x: auto; scrollbar-width: thin; }
.fmlp .toolbar-row .tool { display: inline-flex; align-items: center; gap: 6px; padding: 3px 8px; min-height: 28px; font-size: 13px; color: var(--soft); white-space: nowrap; flex: none; }
.fmlp .toolbar-row button.icon.tool { font-size: 16px; padding: 2px 8px; }
.fmlp .toolbar-row .tool.on { background: var(--sel); color: var(--accent); border-color: var(--accent-dim); }
.fmlp .toolbar-row .tool .glyph { width: 13px; height: 11px; }
.fmlp .tool-sep { width: 1px; height: 18px; background: var(--rule); margin: 0 6px; flex: none; }
.fmlp .toolbar-row .segmented, .fmlp .toolbar-row .zoom, .fmlp .toolbar-row .inserts { display: inline-flex; align-items: center; flex: none; }
.fmlp .zoom-value { min-width: 50px; justify-content: center; font: 12px var(--f-num) !important; }
.fmlp .ico { display: inline-block; width: 16px; height: 13px; border: 1.5px solid currentColor; border-radius: 2px; position: relative; }
.fmlp .ico::after { content: ""; position: absolute; top: 0; bottom: 0; width: 4px; background: currentColor; opacity: 0.55; }
.fmlp .ico.panel-left::after { left: 0; }
.fmlp .ico.panel-right::after { right: 0; }

/* ------------------------------------------------------------ controls */
.fmlp button { cursor: pointer; background: var(--card); border: 1px solid var(--rule); border-radius: 5px; padding: 4px 10px; font: 500 13px var(--f-display); line-height: 1.3; }
.fmlp button:hover:not(:disabled) { border-color: var(--accent-dim); }
.fmlp button:disabled { opacity: 0.4; cursor: default; }
.fmlp button:focus-visible, .fmlp select:focus-visible, .fmlp input:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.fmlp button.primary { background: var(--accent); color: var(--paper); border-color: var(--accent); }
.fmlp button.quiet { background: transparent; border-color: transparent; color: var(--soft); }
.fmlp button.quiet:hover:not(:disabled) { background: var(--chrome); border-color: transparent; color: var(--ink); }
.fmlp button.danger, .fmlp button.icon.danger { color: var(--bad); }
.fmlp button.danger-fill { background: var(--bad); border-color: var(--bad); color: var(--paper); }
.fmlp button.icon { background: transparent; border-color: transparent; padding: 2px 7px; color: var(--soft); font-size: 14px; }
.fmlp button.icon:hover:not(:disabled) { background: var(--card); color: var(--ink); border-color: var(--rule); }
.fmlp select { background: var(--card); border: 1px solid var(--rule); border-radius: 5px; padding: 4px 8px; font-size: 13px; }
.fmlp kbd { font-size: 11px; opacity: 0.75; margin-left: 4px; }
.fmlp .muted { color: var(--soft); font-size: 12.5px; }
.fmlp .hint { color: var(--faint); font-size: 12px; margin: 4px 0; }
.fmlp .pad { padding: 10px 12px; }

.fmlp .segmented { display: inline-flex; background: var(--paper); border: 1px solid var(--rule); border-radius: 7px; padding: 2px; gap: 2px; }
.fmlp .segmented button { border: 0; background: transparent; border-radius: 5px; padding: 4px 12px; color: var(--soft); position: relative; }
.fmlp .segmented button.on { background: var(--card); color: var(--ink); box-shadow: 0 1px 2px rgba(0, 0, 0, 0.12); }
.fmlp .segmented.small button { padding: 2px 10px; font-size: 12px; }
.fmlp .badge-dot { position: absolute; top: 3px; right: 3px; width: 7px; height: 7px; border-radius: 50%; background: var(--s2); }

.fmlp .connect-btn { display: inline-flex; align-items: center; gap: 7px; background: var(--accent); color: var(--paper); border-color: var(--accent); }
.fmlp .connect-btn .dot { box-shadow: 0 0 0 2px var(--accent); }
.fmlp .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--faint); flex: none; }
.fmlp .dot.connected { background: var(--good); }
.fmlp .dot.connecting { background: var(--warn); }
.fmlp .dot.offline { background: var(--bad); }

.fmlp .chip { display: inline-flex; gap: 4px; align-items: center; padding: 1px 8px; border: 1px solid var(--rule); border-radius: 999px; background: var(--card); color: var(--ink); cursor: pointer; font: 400 12.5px var(--f-display); }
.fmlp .chip.on { background: var(--sel); border-color: var(--accent-dim); color: var(--accent); }
.fmlp .chip input { margin: 0; }
.fmlp .chips { display: flex; flex-wrap: wrap; gap: 5px; }
.fmlp .link-chip { margin: 0 4px 4px 0; }
.fmlp .link-chip:hover { color: var(--accent); border-color: var(--accent-dim); }

/* glyphs: small coloured marks that tell kinds apart */
.fmlp .glyph { width: 10px; height: 10px; flex: none; border-radius: 2px; background: var(--faint); display: inline-block; }
.fmlp .glyph.file { background: linear-gradient(135deg, transparent 0 70%, var(--faint) 70%); border: 1.5px solid var(--faint); border-radius: 1px 4px 1px 1px; width: 9px; height: 12px; }
.fmlp .glyph.dimension { background: var(--s5); border-radius: 50%; }
.fmlp .glyph.variable, .fmlp .tree-row.formula .glyph.variable { background: var(--s1); }
.fmlp .tree-row.input .glyph.variable, .fmlp .glyph.variable.input { background: var(--s2); }
.fmlp .glyph.document { background: transparent; border: 1.5px solid var(--accent); border-radius: 1px; height: 12px; width: 9px; }
.fmlp .glyph.block-sheet { background: linear-gradient(var(--s1) 0 0) 0 30% / 100% 1.5px no-repeat, linear-gradient(var(--s1) 0 0) 0 70% / 100% 1.5px no-repeat; border: 1.5px solid var(--s1); border-radius: 2px; }
.fmlp .glyph.block-chart { background: linear-gradient(to top, var(--s2) 60%, transparent 0) 0 100% / 3px 100% no-repeat, linear-gradient(to top, var(--s2) 100%, transparent 0) 50% 100% / 3px 100% no-repeat, linear-gradient(to top, var(--s2) 40%, transparent 0) 100% 100% / 3px 100% no-repeat; border-radius: 0; }
.fmlp .glyph.block-kpi { background: var(--s3); border-radius: 50%; }
.fmlp .glyph.block-text { background: linear-gradient(var(--soft) 0 0) 0 15% / 100% 1.5px no-repeat, linear-gradient(var(--soft) 0 0) 0 50% / 100% 1.5px no-repeat, linear-gradient(var(--soft) 0 0) 0 85% / 60% 1.5px no-repeat; border-radius: 0; }

/* ------------------------------------------------------------ workspaces */
.fmlp .ws { display: grid; height: 100%; min-height: 0; }
.fmlp .model-ws { grid-template-columns: 260px minmax(0, 1fr); }
.fmlp .model-ws.no-explorer { grid-template-columns: minmax(0, 1fr); }
.fmlp .page-ws { grid-template-columns: minmax(0, 1fr); }
.fmlp .page-ws.with-left { grid-template-columns: 270px minmax(0, 1fr); }
.fmlp .page-ws.with-right { grid-template-columns: minmax(0, 1fr) 330px; }
.fmlp .page-ws.with-left.with-right { grid-template-columns: 270px minmax(0, 1fr) 330px; }

.fmlp .side { background: var(--panel); border-right: 1px solid var(--rule); overflow-y: auto; min-height: 0; padding-bottom: 12px; }
.fmlp .side.inspector { border-right: 0; border-left: 1px solid var(--rule); padding: 0 14px 16px; }

.fmlp .tree-section > header { display: flex; align-items: center; position: sticky; top: 0; background: var(--panel); z-index: 1; padding: 6px 6px 2px; }
.fmlp .section-toggle { flex: 1; display: flex; align-items: center; gap: 6px; border: 0; background: transparent; padding: 4px; font: 600 11px var(--f-display); text-transform: uppercase; letter-spacing: 0.07em; color: var(--soft); text-align: left; }
.fmlp .section-toggle .count { margin-left: auto; font: 500 11px var(--f-num); color: var(--faint); letter-spacing: 0; background: none; }
.fmlp .caret { width: 0; height: 0; border-left: 4px solid var(--faint); border-top: 4px solid transparent; border-bottom: 4px solid transparent; transition: transform 0.12s; }
.fmlp .caret.open { transform: rotate(90deg); }
.fmlp .tree-items { display: flex; flex-direction: column; padding: 0 6px 6px; }
.fmlp .tree-items .hint { padding: 0 6px; }
.fmlp .tree-row { display: flex; align-items: center; gap: 8px; width: 100%; border: 0; background: transparent; border-radius: 5px; padding: 4px 8px; text-align: left; font: 400 13px var(--f-display); color: var(--ink); min-width: 0; }
.fmlp .tree-row:hover { background: var(--chrome); }
.fmlp .tree-row.on { background: var(--sel); color: var(--accent); }
.fmlp .tree-row .label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fmlp .tree-row .meta { font: 11px var(--f-num); color: var(--faint); }
.fmlp .tree-row.folder { color: var(--soft); font-weight: 500; gap: 6px; }
.fmlp .tree-row.folder .caret { margin-right: 2px; }
.fmlp .glyph.folder { width: 12px; height: 9px; background: transparent; border: 1.5px solid var(--faint); border-radius: 1px 3px 2px 2px; box-shadow: inset 0 2px 0 var(--faint); }
.fmlp .tree-leaf { display: flex; }
.fmlp .tree-leaf > * { flex: 1; min-width: 0; }
.fmlp .tree-row.var-insert { padding: 0 2px 0 0; }
.fmlp .tree-row .label-btn { flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; border: 0; background: transparent; padding: 4px 8px; text-align: left; font: inherit; }
.fmlp .new-file { padding: 2px 4px 4px; }
.fmlp .new-file input { width: 100%; padding: 4px 8px; border: 1px solid var(--accent-dim); border-radius: 4px; background: var(--paper); font: 12px var(--f-mono); }

/* center: tabs, editor area, bottom panel */
.fmlp .center { display: grid; grid-template-rows: auto minmax(0, 1fr) auto; min-width: 0; min-height: 0; }

.fmlp .doc-tabs { display: flex; overflow-x: auto; background: var(--chrome); border-bottom: 1px solid var(--rule); min-height: 34px; }
.fmlp .doc-tab { display: flex; align-items: center; border-right: 1px solid var(--rule); background: transparent; flex: none; }
.fmlp .doc-tab.on { background: var(--paper); box-shadow: inset 0 2px 0 var(--accent); }
.fmlp .doc-tab .tab-name { display: flex; align-items: center; gap: 7px; border: 0; background: transparent; padding: 7px 4px 7px 12px; font: 13px var(--f-display); color: var(--soft); }
.fmlp .doc-tab.on .tab-name { color: var(--ink); }
.fmlp .doc-tab .tab-close { border: 0; background: transparent; color: var(--faint); padding: 2px 8px; font-size: 14px; opacity: 0; }
.fmlp .doc-tab:hover .tab-close, .fmlp .doc-tab.on .tab-close { opacity: 1; }
.fmlp .doc-tab .dir { color: var(--faint); margin-right: -6px; }
.fmlp .dirty { width: 7px; height: 7px; border-radius: 50%; background: var(--s2); }
.fmlp .editor-area { min-height: 0; overflow: auto; background: var(--paper); }
.fmlp .empty { color: var(--soft); padding: 32px 20px; font-style: italic; }
.fmlp .empty.small { padding: 12px; font-size: 13px; }

.fmlp .file-editor { display: grid; grid-template-rows: auto auto minmax(0, 1fr); height: 100%; }
.fmlp .toolbar { display: flex; align-items: center; gap: 6px; padding: 6px 12px; border-bottom: 1px solid var(--rule); background: var(--paper); }
.fmlp .toolbar .path { font: 12px var(--f-mono); color: var(--soft); }
.fmlp .code { display: grid; grid-template-columns: auto minmax(0, 1fr); min-height: 0; background: var(--card); }
.fmlp .gutter { overflow: hidden; padding: 12px 0; background: var(--chrome); border-right: 1px solid var(--rule); font: 12.5px/20px var(--f-mono); color: var(--faint); text-align: right; user-select: none; }
.fmlp .gutter div { padding: 0 10px 0 14px; min-width: 44px; }
.fmlp .gutter div.warning { color: var(--warn); font-weight: 600; box-shadow: inset 3px 0 0 var(--warn); }
.fmlp .gutter div.info { box-shadow: inset 3px 0 0 var(--rule); }
.fmlp .code textarea { width: 100%; height: 100%; resize: none; border: 0; outline: none; padding: 12px 14px; font: 12.5px/20px var(--f-mono); tab-size: 2; white-space: pre; overflow: auto; background: transparent; color: var(--ink); }
.fmlp .errors { font: 12px/1.5 var(--f-mono); color: var(--bad); background: var(--bad-bg); border-radius: 4px; padding: 8px 10px; overflow-x: auto; }
.fmlp .errors.banner { border-radius: 0; border-bottom: 1px solid var(--rule); }
.fmlp .errors.small { margin: 0 6px 6px; padding: 6px 8px; font-size: 11.5px; }
.fmlp .errors strong { font-family: var(--f-display); display: block; margin-bottom: 4px; }

.fmlp .item-view { padding: 18px 22px 28px; display: flex; flex-direction: column; gap: 14px; max-width: 1200px; }
.fmlp .item-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.fmlp .item-head h2 { margin: 0; font: 700 20px var(--f-display); letter-spacing: -0.01em; }
.fmlp .badge { font: 600 10.5px var(--f-display); text-transform: uppercase; letter-spacing: 0.06em; padding: 2px 7px; border-radius: 4px; background: var(--chrome); color: var(--soft); }
.fmlp .badge.input { background: color-mix(in srgb, var(--s2) 16%, transparent); color: var(--s2); }
.fmlp .badge.calculated { background: var(--sel); color: var(--accent); }
.fmlp .facts { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px 18px; margin: 0; }
.fmlp .facts > div { min-width: 0; }
.fmlp .facts dt { font: 600 10.5px var(--f-display); text-transform: uppercase; letter-spacing: 0.07em; color: var(--faint); margin-bottom: 3px; }
.fmlp .facts dd { margin: 0; }
.fmlp .facts.compact { grid-template-columns: 1fr 1fr; gap: 6px 12px; flex-basis: 100%; }
.fmlp .num { font-variant-numeric: tabular-nums; font-family: var(--f-num); }
.fmlp .decl { padding: 10px 12px; background: var(--card); border: 1px solid var(--rule); border-radius: 6px; overflow-x: auto; font-size: 12.5px; line-height: 1.55; }

/* bottom panel */
.fmlp .panel { border-top: 1px solid var(--rule); background: var(--panel); display: grid; grid-template-rows: auto minmax(0, 1fr); }
.fmlp .panel.open { height: 34vh; min-height: 150px; }
.fmlp .panel-tabs { display: flex; align-items: center; gap: 2px; padding: 0 8px; border-bottom: 1px solid var(--rule); }
.fmlp .panel-tabs > button:not(.icon) { border: 0; background: transparent; border-radius: 0; padding: 7px 10px; font: 600 11px var(--f-display); text-transform: uppercase; letter-spacing: 0.06em; color: var(--soft); box-shadow: inset 0 -2px 0 transparent; }
.fmlp .panel-tabs > button.on { color: var(--ink); box-shadow: inset 0 -2px 0 var(--accent); }
.fmlp .count { display: inline-block; margin-left: 6px; font: 500 10.5px var(--f-num); background: var(--chrome); color: var(--soft); border-radius: 8px; padding: 0 6px; letter-spacing: 0; }
.fmlp .panel .list { list-style: none; margin: 0; padding: 4px 0; overflow-y: auto; min-height: 0; font-size: 13px; }
.fmlp .panel .list li { display: flex; align-items: baseline; gap: 8px; padding: 3px 12px; }
.fmlp .panel .list li > button { flex: 1; text-align: left; border: 0; background: transparent; padding: 0; font: inherit; display: flex; gap: 8px; align-items: baseline; min-width: 0; border-radius: 0; }
.fmlp .panel .list li:hover { background: var(--chrome); }
.fmlp .panel .list code { font-size: 11.5px; color: var(--accent); }
.fmlp .panel .list time { font: 11px var(--f-num); color: var(--faint); }
.fmlp .panel .list li.error code { color: var(--bad); }
.fmlp .sev { width: 8px; height: 8px; border-radius: 50%; flex: none; background: var(--faint); align-self: center; }
.fmlp .sev.warning { background: var(--warn); }
.fmlp .sev.error { background: var(--bad); }
.fmlp .panel .list li > button.topic { flex: none; display: inline-block; border: 1px solid var(--accent-dim); background: var(--sel); color: var(--accent); padding: 0 7px; font: 500 11.5px var(--f-mono); border-radius: 999px; }
.fmlp .panel .list li > button.inline { flex: 1; display: block; color: var(--ink); }
.fmlp .panel .inline { border: 0; background: transparent; padding: 0; text-align: left; font: inherit; }
.fmlp .panel .inline:hover { color: var(--accent); }
.fmlp .review { display: grid; grid-template-columns: minmax(0, 1fr) auto; min-height: 0; overflow: hidden; }
.fmlp .advice { width: min(440px, 45vw); border-left: 1px solid var(--rule); padding: 10px 14px; overflow-y: auto; font-size: 13px; }
.fmlp .advice header { display: flex; align-items: center; gap: 8px; justify-content: space-between; }
.fmlp .advice ul { padding-left: 18px; margin: 8px 0; }
.fmlp .advice li { margin: 3px 0; }
.fmlp .advice pre { background: var(--paper); border: 1px solid var(--rule); border-radius: 4px; padding: 8px; font-size: 11.5px; overflow-x: auto; }
.fmlp .advice .label { font: 600 10.5px var(--f-display); text-transform: uppercase; letter-spacing: 0.06em; margin: 8px 0 3px; }
.fmlp .advice .label.bad { color: var(--bad); }
.fmlp .advice .label.good { color: var(--good); }

/* ------------------------------------------------------------ documents */
.fmlp .palette { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; padding: 2px 2px 6px; }
.fmlp .tile { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 10px 6px; font-size: 12.5px; }
.fmlp .tile .glyph { width: 16px; height: 14px; }
.fmlp .tile:hover { background: var(--sel); }

.fmlp .canvas-wrap { display: grid; grid-template-rows: minmax(0, 1fr); min-width: 0; min-height: 0; background: var(--chrome); }
.fmlp .canvas { overflow: auto; padding: 24px 24px 48px; min-height: 0; }
.fmlp .doc { max-width: 1040px; margin: 0 auto; background: var(--paper); border: 1px solid var(--rule); border-radius: 8px; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06), 0 8px 24px rgba(0, 0, 0, 0.04); padding: 28px 32px 32px; display: flex; flex-direction: column; gap: 6px; min-height: 60%; }
.fmlp .doc-title { font: 700 26px/1.2 var(--f-display); letter-spacing: -0.015em; margin: 0 0 10px; border: 1px solid transparent; background: transparent; padding: 2px 6px; margin-left: -7px; border-radius: 5px; width: 100%; color: var(--ink); }
.fmlp input.doc-title:hover { border-color: var(--rule); }
.fmlp input.doc-title:focus { border-color: var(--accent-dim); background: var(--card); outline: none; }
.fmlp .doc-row { display: flex; flex-direction: column; }
.fmlp .doc-row.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; padding-block: 8px; }
.fmlp .blk { position: relative; border: 1px solid transparent; border-radius: 7px; padding: 10px; margin: 0 -11px; }
.fmlp .doc-row.kpis .blk { margin: 0; padding: 0; }
.fmlp .page-ws.editing .blk { cursor: pointer; }
.fmlp .page-ws.editing .blk:hover { border-color: var(--rule); }
.fmlp .blk.selected, .fmlp .page-ws.editing .blk.selected:hover { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-dim); }
.fmlp .blk-tools { position: absolute; top: -12px; right: 8px; display: none; align-items: center; gap: 1px; background: var(--card); border: 1px solid var(--rule); border-radius: 6px; padding: 1px 3px; box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08); z-index: 2; }
.fmlp .blk:hover .blk-tools, .fmlp .blk.selected .blk-tools { display: flex; }
.fmlp .blk-tools .kind { font: 600 10px var(--f-display); text-transform: uppercase; letter-spacing: 0.06em; color: var(--accent); padding: 0 6px; }
.fmlp .blk-tools button.icon { padding: 0 6px; font-size: 13px; }
.fmlp .add-row { display: flex; gap: 4px; flex-wrap: wrap; padding-top: 12px; margin-top: 8px; border-top: 1px dashed var(--rule); }
.fmlp .empty-doc { padding: 18px 0 6px; }
.fmlp .empty-doc p { max-width: 60ch; color: var(--soft); margin: 0; }

.fmlp .inspector-head { display: flex; align-items: center; gap: 8px; padding: 12px 0 10px; border-bottom: 1px solid var(--rule); margin-bottom: 12px; position: sticky; top: 0; background: var(--panel); z-index: 1; flex-basis: 100%; color: var(--ink); font-size: 13px; }
.fmlp .form { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; font: 500 12px var(--f-display); color: var(--soft); }
.fmlp .form > label, .fmlp .filters label { display: flex; flex-direction: column; gap: 3px; flex: 1 1 120px; min-width: 0; }
.fmlp .form .wide { flex-basis: 100%; }
.fmlp .form label.check { flex-direction: row; gap: 6px; align-items: center; color: var(--ink); font-weight: 400; }
.fmlp .form input:not([type]), .fmlp .form input[type="text"], .fmlp .form select { width: 100%; padding: 5px 8px; border: 1px solid var(--rule); border-radius: 5px; background: var(--paper); min-width: 0; font: 13px var(--f-display); color: var(--ink); }
.fmlp .form fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
.fmlp .form legend { padding: 0; margin-bottom: 5px; }
.fmlp .filters { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.fmlp .md-input { width: 100%; padding: 8px 10px; font: 12.5px/1.5 var(--f-mono); background: var(--paper); border: 1px solid var(--rule); border-radius: 5px; resize: vertical; color: var(--ink); }
.fmlp .confirm { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; color: var(--ink); }

/* ------------------------------------------------------------ blocks */
.fmlp figure { margin: 0; }
.fmlp figcaption { font: 600 12px var(--f-display); color: var(--soft); text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 6px; }
.fmlp .md { font: 15px/1.55 var(--f-body); }
.fmlp .md h2 { font: 700 19px var(--f-display); margin: 4px 0; }
.fmlp .md h3 { font: 600 16px var(--f-display); margin: 4px 0; }
.fmlp .md p, .fmlp .md li { margin: 4px 0; max-width: 72ch; }
.fmlp .md code { background: var(--chrome); padding: 1px 4px; border-radius: 3px; font-size: 0.88em; }

.fmlp .kpi { padding: 12px 14px; background: var(--card); border: 1px solid var(--rule); border-radius: 7px; height: 100%; }
.fmlp .kpi figcaption { margin-bottom: 2px; font-size: 11px; }
.fmlp .kpi-value { font: 700 28px/1.2 var(--f-display); font-variant-numeric: tabular-nums; letter-spacing: -0.015em; }
.fmlp .kpi-at { font: 11.5px var(--f-num); color: var(--faint); margin-top: 2px; }

.fmlp .scroll { overflow-x: auto; border: 1px solid var(--rule); border-radius: 6px; background: var(--card); scrollbar-width: thin; scrollbar-color: var(--rule) transparent; }
/* A table wider than the page: the scrollbar stays (no overlay that hides), a shade marks the edge with more beyond. */
.fmlp .scroll-x { position: relative; }
.fmlp .scroll-x .scroll::-webkit-scrollbar { height: 8px; }
.fmlp .scroll-x .scroll::-webkit-scrollbar-thumb { background: var(--rule); border-radius: 4px; }
.fmlp .scroll-x::before, .fmlp .scroll-x::after { content: ""; position: absolute; top: 1px; bottom: 9px; width: 22px; pointer-events: none; opacity: 0; transition: opacity 0.15s; z-index: 3; }
.fmlp .scroll-x::after { right: 1px; background: linear-gradient(to left, color-mix(in srgb, var(--ink) 14%, transparent), transparent); border-radius: 0 6px 6px 0; }
.fmlp .scroll-x::before { left: var(--first-col, 0px); background: linear-gradient(to right, color-mix(in srgb, var(--ink) 10%, transparent), transparent); }
.fmlp .scroll-x.more-right::after, .fmlp .scroll-x.more-left::before { opacity: 1; }
.fmlp .scroll-x thead th:first-child { position: sticky; left: 0; z-index: 2; }
.fmlp .scroll-x tbody th { z-index: 1; box-shadow: 1px 0 0 var(--rule); }
/* The total column stays in view at the right edge. */
.fmlp .scroll-x th.total, .fmlp .scroll-x td.total { position: sticky; right: 0; z-index: 1; background: var(--card); box-shadow: -1px 0 0 var(--rule); }
.fmlp .scroll-x thead th.total { background: var(--chrome); z-index: 2; }
.fmlp .scroll-x tr.total th { background: var(--card); }
.fmlp table { border-collapse: collapse; font: 12.5px var(--f-num); font-variant-numeric: tabular-nums; width: max-content; min-width: 100%; margin: 0; }
.fmlp th, .fmlp td { text-transform: none; letter-spacing: normal; padding: 5px 9px; border-bottom: 1px solid var(--rule); text-align: right; white-space: nowrap; }
.fmlp thead th { font: 600 11.5px var(--f-display); color: var(--soft); background: var(--chrome); position: sticky; top: 0; }
.fmlp tbody th { text-align: left; font: 500 12.5px var(--f-display); position: sticky; left: 0; background: var(--card); }
.fmlp th.left, .fmlp td.left { text-align: left; }
.fmlp td.input { padding: 0; background: var(--sel); }
.fmlp td.input input { width: 78px; border: 0; background: transparent; text-align: right; padding: 5px 9px; font: inherit; }
.fmlp td.input input:focus { outline: 2px solid var(--accent); outline-offset: -2px; background: var(--card); }
.fmlp tr.total th, .fmlp tr.total td { font-weight: 700; border-top: 1px solid var(--soft); }
.fmlp th.total, .fmlp td.total { font-weight: 700; border-left: 1px solid var(--rule); }

.fmlp .chart svg { width: 100%; max-width: 100%; height: auto; background: var(--card); border: 1px solid var(--rule); border-radius: 6px; display: block; }
.fmlp .chart .grid { stroke: var(--rule); stroke-width: 1; }
.fmlp .chart .tick { fill: var(--soft); font: 10px var(--f-mono); }
.fmlp .chart .bar { stroke: none; }
.fmlp .chart .s0, .fmlp .legend i.s0 { stroke: var(--s1); fill: var(--s1); background: var(--s1); }
.fmlp .chart .s1, .fmlp .legend i.s1 { stroke: var(--s2); fill: var(--s2); background: var(--s2); }
.fmlp .chart .s2, .fmlp .legend i.s2 { stroke: var(--s3); fill: var(--s3); background: var(--s3); }
.fmlp .chart .s3, .fmlp .legend i.s3 { stroke: var(--s4); fill: var(--s4); background: var(--s4); }
.fmlp .chart .s4, .fmlp .legend i.s4 { stroke: var(--s5); fill: var(--s5); background: var(--s5); }
.fmlp .chart .s5, .fmlp .legend i.s5 { stroke: var(--s6); fill: var(--s6); background: var(--s6); }
.fmlp .chart .s6, .fmlp .legend i.s6 { stroke: var(--s7); fill: var(--s7); background: var(--s7); }
.fmlp .chart .s7, .fmlp .legend i.s7 { stroke: var(--s8); fill: var(--s8); background: var(--s8); }
.fmlp .chart .line { stroke-width: 2; fill: none; }
.fmlp .legend { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 6px; font: 12px var(--f-display); color: var(--soft); }
.fmlp .legend i { display: inline-block; width: 12px; height: 3px; margin-right: 6px; vertical-align: middle; }

/* ------------------------------------------------------------ dialogs */
.fmlp .overlay { position: fixed; inset: 0; background: rgba(15, 18, 26, 0.45); display: grid; place-items: start center; padding: 9vh 16px 16px; z-index: 20; overflow-y: auto; }
.fmlp .dialog { width: min(640px, 100%); background: var(--paper); border: 1px solid var(--rule); border-radius: 10px; box-shadow: 0 16px 48px rgba(0, 0, 0, 0.25); padding: 18px 22px 22px; display: flex; flex-direction: column; gap: 12px; font: 14px/1.5 var(--f-display); }
.fmlp .dialog header { display: flex; align-items: center; justify-content: space-between; }
.fmlp .dialog h2 { margin: 0; font: 700 18px var(--f-display); }
.fmlp .dialog p, .fmlp .dialog ul, .fmlp .dialog ol { margin: 0; }
.fmlp .dialog ol, .fmlp .dialog ul { padding-left: 20px; }
.fmlp .dialog li { margin: 3px 0; }
.fmlp .relay-state { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--soft); }
.fmlp .url { display: flex; gap: 6px; }
.fmlp .url input { flex: 1; min-width: 0; font-size: 12px; padding: 6px 8px; border: 1px solid var(--rule); border-radius: 5px; background: var(--card); }
.fmlp .cmd { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px; align-items: start; }
.fmlp .cmd pre { padding: 8px 10px; background: var(--card); border: 1px solid var(--rule); border-radius: 5px; overflow-x: auto; font-size: 12px; }
.fmlp .cmd p { grid-column: 1 / -1; margin: 0; }

/* ------------------------------------------------------------ narrow screens: stack, the page scrolls */
@media (max-width: 1100px) {
  .fmlp .toolbar-row .tool-label { display: none; }
}
@media (max-width: 860px) {
  /* The shell keeps its bars; what is between them stacks and scrolls. */
  .fmlp .topbar, .fmlp .toolbar-row { padding-inline: 16px; }
  .fmlp .views { overflow-y: auto; }
  .fmlp .ws { height: auto; }
  .fmlp .model-ws, .fmlp .page-ws, .fmlp .page-ws.with-left, .fmlp .page-ws.with-right, .fmlp .page-ws.with-left.with-right { grid-template-columns: minmax(0, 1fr); }
  .fmlp .side.format { border-left: 0; border-top: 1px solid var(--rule); overflow: visible; max-height: none; }
  .fmlp .side.format .builder-body { overflow: visible; }
  .fmlp .save-status { max-width: 22ch; }
  .fmlp .side { max-height: 40vh; border-right: 0; border-bottom: 1px solid var(--rule); }
  .fmlp .side.inspector { max-height: none; border-left: 0; border-top: 1px solid var(--rule); }
  .fmlp .center { grid-template-rows: auto auto auto; }
  .fmlp .model-side { grid-template-rows: auto; }
  .fmlp .pane { min-height: 80vh; }
  .fmlp .editor-area { min-height: 60vh; }
  .fmlp .panel.open { height: auto; max-height: 50vh; }
  .fmlp .canvas { padding: 12px; }
  .fmlp .doc { padding: 18px 16px; }
  .fmlp .hide-narrow { display: none; }
  .fmlp .tab-status { gap: 8px; padding: 0 10px; }
  .fmlp .tab-status .hide-narrow { display: none; }
  .fmlp .review { grid-template-columns: minmax(0, 1fr); }
  .fmlp .advice { width: auto; border-left: 0; border-top: 1px solid var(--rule); }
}
@media (max-width: 560px) {
  .fmlp .connect-label { display: none; }
  .fmlp .connect-btn { padding: 8px 10px; }
  .fmlp .mark { padding: 6px 6px; font-size: 12px; }
  .fmlp .save-status { display: none; }
  .fmlp .page-tab .tab-name { max-width: 140px; }
  .fmlp .menu-title { padding: 2px 6px; }
  .fmlp .topbar { gap: 8px; }
}


/* ------------------------------------------------------------ entity colours (Workbench entities.css) */
.fmlp { --var-bg: #f1e9fd; --var-ink: #7e3fe0; --var-line: #e2d2fb; --dim-bg: #e2ecfe; --dim-ink: #2f66e8; --dim-line: #cddcfc; --grain-bg: #ffffff; --grain-ink: #2f66e8; --grain-line: #bcd0fb; --chain-below: #2f9e8f; --chain-above: #3b6fd8; --warn-soft: #fbf0d9; --bad-soft: var(--bad-bg); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .fmlp { --var-bg: #2c2140; --var-ink: #c4a3ff; --var-line: #45335f; --dim-bg: #183037; --dim-ink: #8ccfe3; --dim-line: #2a4c55; --grain-bg: #161c22; --grain-ink: #8fb2ff; --grain-line: #2f4270; --chain-below: #4fb39a; --chain-above: #6fb3d6; --warn-soft: #3a2f17; }
}
:root[data-theme="dark"] .fmlp { --var-bg: #2c2140; --var-ink: #c4a3ff; --var-line: #45335f; --dim-bg: #183037; --dim-ink: #8ccfe3; --dim-line: #2a4c55; --grain-bg: #161c22; --grain-ink: #8fb2ff; --grain-line: #2f4270; --chain-below: #4fb39a; --chain-above: #6fb3d6; --warn-soft: #3a2f17; }

/* ------------------------------------------------------------ graph (Workbench FolderGraph) */
.fmlp .graph { display: grid; grid-template-rows: minmax(0, 1fr) auto; height: 100%; min-height: 0; background: var(--paper); }
.fmlp .graph-area { position: relative; min-height: 0; min-width: 0; display: flex; }
.fmlp .graph-scroll { min-width: 0; }
.fmlp .graph-scroll { flex: 1; overflow: auto; overflow-anchor: none; }
.fmlp .graph svg { display: block; }
.fmlp .graph svg text { font-family: var(--f-display); font-size: 11px; fill: var(--ink); }
.fmlp .graph .node rect { fill: var(--var-bg); stroke: var(--var-line); }
.fmlp .graph .node.k-in rect { fill: color-mix(in srgb, var(--s2) 12%, var(--card)); stroke: color-mix(in srgb, var(--s2) 40%, var(--card)); }
.fmlp .graph .node.sel rect { stroke: var(--var-ink); stroke-width: 2; }
.fmlp .graph .edge { fill: none; stroke-width: 1.4; }
.fmlp .graph .edge.placing { stroke: var(--accent); }
.fmlp .graph .edge.value { stroke: var(--faint); stroke-dasharray: 5 4; }
.fmlp .graph .edge-label { font-size: 10px !important; fill: var(--soft) !important; }
.fmlp .graph .colhead { fill: var(--soft); font-size: 10px; letter-spacing: 0.08em; }
.fmlp .graph .colhead.dim { fill: var(--dim-ink); }
.fmlp .graph line.band { stroke: var(--rule); stroke-dasharray: 3 4; }
.fmlp .gnode { box-sizing: border-box; height: 100%; padding: 7px 10px 6px 12px; display: flex; flex-direction: column; gap: 3px; font: 11px/1.3 var(--f-display); color: var(--ink); overflow: hidden; }
.fmlp .gnode .gn-name { display: flex; align-items: center; gap: 5px; font-weight: 600; color: var(--var-ink); font-size: 12px; min-width: 0; }
.fmlp .graph .node.k-in .gn-name { color: color-mix(in srgb, var(--s2) 85%, var(--ink)); }
.fmlp .gnode .gn-name .x { font-size: 10px; opacity: 0.8; }
.fmlp .gnode .gn-name .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fmlp .gnode .gn-folder { color: var(--soft); font-size: 10px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fmlp .gnode .gn-formula { font-family: var(--f-mono); font-size: 10px; color: var(--soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-height: 13px; }
.fmlp .gnode .gn-grain { display: flex; flex-wrap: nowrap; gap: 3px; overflow: hidden; }
.fmlp .gnode .gn-grain .g { flex: none; padding: 0 5px; border: 1px solid var(--grain-line); border-radius: 5px; background: var(--grain-bg); color: var(--grain-ink); font-size: 9.5px; font-weight: 600; line-height: 15px; }
.fmlp .gnode .gn-grain .g.pinned { border-width: 1.5px; }
.fmlp .gnode .gn-stats { margin-top: auto; border-top: 1px dashed var(--var-line); padding-top: 3px; font-family: var(--f-mono); font-size: 9.5px; color: var(--soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fmlp .graph .node.dimnode rect { fill: var(--dim-bg); stroke: var(--dim-line); }
.fmlp .graph .node.dimnode.sel rect { stroke: var(--dim-ink); stroke-width: 2; }
.fmlp .graph .edge.link { stroke: var(--dim-ink); stroke-width: 1.6; }
.fmlp .gnode.dim .gn-name { color: var(--dim-ink); }
.fmlp .gnode.dim .gn-stats { border-top-color: var(--dim-line); }
.fmlp .graph .node.dimnode.chain-below rect { fill: color-mix(in srgb, var(--chain-below) 16%, var(--card)); stroke: var(--chain-below); }
.fmlp .graph .node.dimnode.chain-above rect { fill: color-mix(in srgb, var(--chain-above) 16%, var(--card)); stroke: var(--chain-above); }
.fmlp .graph .node.chain-below:not(.dimnode) rect { fill: color-mix(in srgb, var(--chain-below) 14%, var(--card)); stroke: var(--chain-below); stroke-width: 1.5; }
.fmlp .graph .node.chain-above:not(.dimnode) rect { fill: color-mix(in srgb, var(--chain-above) 14%, var(--card)); stroke: var(--chain-above); stroke-width: 1.5; }
.fmlp .graph .edge.chain-below { stroke: var(--chain-below) !important; stroke-width: 2; }
.fmlp .graph .edge.chain-above { stroke: var(--chain-above) !important; stroke-width: 2; }
.fmlp .graph .node.cost-hot rect { fill: var(--bad-soft); stroke: var(--bad); stroke-width: 2; }
.fmlp .graph .node.cost-warm rect { fill: var(--warn-soft); stroke: var(--warn); }
.fmlp .graph .node.cost-cool rect { opacity: 0.7; }
.fmlp .graph .gn-cost { color: var(--bad); }
.fmlp .graph .gmove { transition: transform 0.55s cubic-bezier(0.2, 0.8, 0.2, 1), d 0.55s cubic-bezier(0.2, 0.8, 0.2, 1), opacity 0.35s ease; }
.fmlp .graph .gfit { transition: transform 0.45s cubic-bezier(0.2, 0.8, 0.2, 1); }
@media (prefers-reduced-motion: reduce) { .fmlp .graph .gmove, .fmlp .graph .gfit { transition: none; } }
.fmlp .graph-bar { display: flex; align-items: center; gap: 8px; padding: 7px 12px; border-top: 1px solid var(--rule); background: var(--chrome); overflow-x: auto; white-space: nowrap; }
.fmlp .graph-bar button.on { background: var(--sel); border-color: var(--accent-dim); color: var(--accent); }
.fmlp .legend-chip { font: 12px var(--f-display); color: var(--soft); border: 1px solid var(--rule); border-radius: 999px; padding: 1px 9px; background: var(--card); }
.fmlp .graph-actions { display: flex; gap: 6px; }
.fmlp .graph-legend { display: flex; align-items: center; gap: 14px; font: 11.5px var(--f-display); color: var(--soft); }
.fmlp .graph-legend .key { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.fmlp .graph-legend .key i { display: inline-block; width: 18px; height: 0; border-top: 2px solid var(--accent); }
.fmlp .graph-legend .key.value i { border-top: 2px dashed var(--soft); }
.fmlp .graph-legend .key.link i { border-top-color: var(--dim-line); }
.fmlp .graph-legend .key b { display: inline-block; width: 4px; height: 12px; border-radius: 2px; }
.fmlp .legend-chip.placing { color: var(--accent); }
.fmlp .legend-chip.link { color: var(--dim-ink); border-color: var(--dim-line); }
.fmlp .graph-minimap { position: absolute; bottom: 12px; z-index: 7; border: 1px solid var(--rule); border-radius: 8px; background: color-mix(in srgb, var(--card) 92%, transparent); box-shadow: 0 6px 18px rgba(0, 0, 0, 0.12); cursor: pointer; overflow: hidden; user-select: none; }
.fmlp .graph-minimap svg { display: block; }
.fmlp .graph-minimap .gm-variable { fill: color-mix(in srgb, var(--var-ink) 55%, transparent); }
.fmlp .graph-minimap .gm-dimension { fill: color-mix(in srgb, var(--dim-ink) 55%, transparent); }
.fmlp .graph-minimap .sel { fill: var(--accent); }
.fmlp .graph-minimap .dim { opacity: 0.14; }
.fmlp .graph-minimap .gm-view { fill: color-mix(in srgb, var(--accent) 12%, transparent); stroke: var(--accent); stroke-width: 1.5; }
.fmlp .gdetail { position: absolute; left: 0; right: 0; bottom: 0; z-index: 8; background: var(--card); border-top: 1px solid var(--rule); box-shadow: 0 -6px 18px rgba(0, 0, 0, 0.08); overflow: auto; padding: 0 16px 12px; display: flex; flex-direction: column; gap: 8px; }
.fmlp .gdetail .gd-head { display: flex; align-items: center; gap: 8px; position: sticky; top: 0; z-index: 2; background: var(--card); padding: 10px 0 8px; border-bottom: 1px solid var(--rule); flex-wrap: wrap; }
.fmlp .gdetail .gd-cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 12px 24px; align-items: start; }
.fmlp .gdetail .gd-sec { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.fmlp .gdetail .h { font: 600 11px var(--f-display); letter-spacing: 0.06em; text-transform: uppercase; color: var(--soft); }
.fmlp .gdetail .h.sub { margin-top: 4px; }
.fmlp .gdetail .gd-code { margin: 0; padding: 8px; border-radius: 6px; background: var(--paper); border: 1px solid var(--rule); font: 11.5px/1.45 var(--f-mono); white-space: pre-wrap; word-break: break-word; max-height: 120px; overflow: auto; }
.fmlp .gdetail .gd-code.codes { color: var(--var-ink); }
.fmlp .gdetail .gd-legend { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 12px; color: var(--soft); align-items: center; }
.fmlp .gdetail .gd-legend b { font-family: var(--f-mono); color: var(--var-ink); }
.fmlp .kv { display: grid; grid-template-columns: max-content 1fr; gap: 4px 12px; font-size: 13px; align-items: baseline; }
.fmlp .kv > :nth-child(odd) { color: var(--soft); }
.fmlp .chip.grain { border-color: var(--grain-line); background: var(--grain-bg); color: var(--grain-ink); font-weight: 600; cursor: default; }

/* ------------------------------------------------------------ performance */
.fmlp .perf { padding: 18px 22px 28px; display: flex; flex-direction: column; gap: 14px; height: 100%; overflow: auto; background: var(--paper); }
.fmlp .perf-head { display: flex; align-items: flex-start; gap: 16px; flex-wrap: wrap; justify-content: space-between; }
.fmlp .perf-head h2 { margin: 0; font: 700 20px var(--f-display); }
.fmlp .perf-head p { margin: 4px 0 0; max-width: 70ch; }
.fmlp .perf-kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; }
.fmlp .kpi-value.small { font-size: 18px; line-height: 1.5; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fmlp .perf-table th.sortable { cursor: pointer; user-select: none; }
.fmlp .perf-table th.sortable.on { color: var(--accent); }
.fmlp .perf-table th.sortable.on::after { content: " ↓"; }
.fmlp .perf-table .bar-col { min-width: 180px; width: 22%; position: relative; }
.fmlp .perf-bar { display: inline-block; height: 9px; border-radius: 2px; background: var(--accent); vertical-align: middle; opacity: 0.75; max-width: calc(100% - 46px); }
.fmlp .perf-pct { font-size: 11px; color: var(--soft); margin-left: 6px; }
.fmlp .perf-table tr.oracle th button { color: var(--warn); }
.fmlp .perf-table td.warn, .fmlp .perf-table .warn { color: var(--warn); font-weight: 600; }
.fmlp .perf-table th button.inline, .fmlp button.inline { border: 0; background: transparent; padding: 0; font: inherit; color: var(--ink); text-align: left; }
.fmlp button.inline:hover { color: var(--accent); text-decoration: underline; }

/* ------------------------------------------------------------ document filters */
.fmlp .filter-bar { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; padding: 0 0 12px; margin-bottom: 6px; border-bottom: 1px solid var(--rule); }
.fmlp .doc-filter { display: inline-flex; align-items: center; gap: 4px; border: 1px solid var(--accent-dim); background: var(--sel); border-radius: 999px; padding: 1px 3px 1px 10px; font: 500 12px var(--f-display); color: var(--accent); }
.fmlp .doc-filter select { border: 0; background: transparent; font: 600 12.5px var(--f-display); color: var(--ink); padding: 2px 2px; }
.fmlp .doc-filter button.icon { padding: 0 5px; font-size: 13px; }
.fmlp .doc-filter.stale { border-color: var(--bad); }
.fmlp .add-filter { border: 1px dashed var(--rule); background: transparent; border-radius: 999px; font: 500 12px var(--f-display); color: var(--soft); padding: 3px 10px; }

/* ------------------------------------------------------------ editing a declaration and members */
.fmlp .decl-edit { border: 1px solid var(--rule); border-radius: 6px; background: var(--card); overflow: hidden; }
.fmlp .decl-edit.dirty { border-color: var(--accent-dim); }
.fmlp .decl-bar { display: flex; align-items: center; gap: 6px; padding: 5px 10px; background: var(--chrome); border-bottom: 1px solid var(--rule); flex-wrap: wrap; }
.fmlp .item-view > .decl-bar { border: 1px solid var(--rule); border-radius: 6px; }
.fmlp .decl-input { display: block; width: 100%; border: 0; outline: none; resize: vertical; padding: 10px 12px; font: 12.5px/1.55 var(--f-mono); background: transparent; color: var(--ink); tab-size: 2; white-space: pre; overflow-x: auto; }
.fmlp .decl-edit .errors { border-radius: 0; }
.fmlp table.members.editable td.cell-edit { padding: 0; }
.fmlp table.members td.cell-edit input, .fmlp table.members td.cell-edit select { width: 100%; min-width: 110px; border: 0; background: transparent; padding: 5px 9px; font: 12.5px var(--f-display); color: var(--ink); }
.fmlp table.members td.cell-edit input:focus, .fmlp table.members td.cell-edit select:focus { outline: 2px solid var(--accent); outline-offset: -2px; background: var(--paper); }
.fmlp table.members tr.new td { background: color-mix(in srgb, var(--good) 8%, transparent); }
.fmlp table.members tr.changed td:first-child { box-shadow: inset 3px 0 0 var(--s2); }
.fmlp .add-member { margin-top: 6px; }

/* ------------------------------------------------------------ charts (ECharts), forms, top-down cells */
.fmlp .chart-box { width: 100%; height: 280px; background: var(--card); border: 1px solid var(--rule); border-radius: 6px; }
.fmlp .chart-box.loading { background: linear-gradient(90deg, var(--card), var(--chrome), var(--card)); background-size: 200% 100%; animation: fmlp-shimmer 1.2s linear infinite; }
@keyframes fmlp-shimmer { to { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) { .fmlp .chart-box.loading { animation: none; } }
.fmlp td.input.aggregate { background: color-mix(in srgb, var(--s2) 14%, var(--card)); }
.fmlp td.input.aggregate input { font-weight: 600; }
.fmlp .form-block { background: var(--card); border: 1px solid var(--rule); border-radius: 7px; padding: 12px 14px; display: flex; flex-direction: column; gap: 10px; }
.fmlp .form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px 18px; }
.fmlp .form-field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.fmlp .form-label { font: 500 13px var(--f-display); color: var(--ink); display: flex; flex-direction: column; }
.fmlp .form-label small { font: 11px var(--f-num); color: var(--faint); }
.fmlp .form-input { display: flex; align-items: center; gap: 6px; }
.fmlp .form-input input { flex: 1; min-width: 0; padding: 6px 9px; border: 1px solid var(--rule); border-radius: 5px; background: var(--sel); font: 14px var(--f-num); text-align: right; color: var(--ink); }
.fmlp .form-input input:focus { outline: 2px solid var(--accent); outline-offset: -1px; background: var(--paper); }
.fmlp .form-field.changed input { border-color: var(--s2); }
.fmlp .form-input .unit { color: var(--soft); font: 13px var(--f-num); }
.fmlp .form-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.fmlp .form-actions .ok { color: var(--good); font-size: 13px; }
.fmlp .form-actions .bad { color: var(--bad); font-size: 13px; }
.fmlp .field-edit { border: 1px solid var(--rule) !important; border-radius: 6px; padding: 6px 8px 8px !important; }
.fmlp .field-edit legend { display: flex; align-items: center; gap: 4px; padding: 0 4px !important; }
.fmlp details.advanced summary { cursor: pointer; color: var(--soft); font: 500 12px var(--f-display); margin-bottom: 6px; }
.fmlp .errors.small-inline { margin: 4px 0 0; padding: 4px 8px; font-size: 11.5px; }
.fmlp .glyph.block-form { background: linear-gradient(var(--s2) 0 0) 0 25% / 100% 2px no-repeat, linear-gradient(var(--s2) 0 0) 0 75% / 100% 2px no-repeat; border: 1.5px solid var(--s2); border-radius: 2px; }

/* ------------------------------------------------------------ semantic model: the L2 menu and its pages */
.fmlp .model-side { display: grid; grid-template-rows: minmax(0, 1fr); height: 100%; min-height: 0; }
.fmlp .pane { display: grid; grid-template-rows: auto minmax(0, 1fr); min-height: 0; min-width: 0; }
.fmlp .pane-head { display: flex; align-items: center; gap: 8px; padding: 7px 14px; border-bottom: 1px solid var(--rule); background: var(--chrome); flex-wrap: wrap; }
.fmlp .pane-head .t { font: 600 13px var(--f-display); color: var(--ink); }
.fmlp .pane-head .chip { cursor: default; font-size: 12px; color: var(--soft); }
.fmlp .pane-body { min-height: 0; min-width: 0; overflow: hidden; }
.fmlp .seg { display: inline-flex; border: 1px solid var(--rule); border-radius: 5px; overflow: hidden; }
.fmlp .seg button { border: 0; border-radius: 0; background: var(--card); padding: 3px 12px; }
.fmlp .seg button + button { border-left: 1px solid var(--rule); }
.fmlp .seg button.on { background: var(--accent); color: var(--paper); }
.fmlp .fml-text { height: 100%; overflow: auto; padding: 14px 18px 28px; background: var(--paper); display: flex; flex-direction: column; gap: 16px; }
.fmlp .fml-doc { flex: none; border: 1px solid var(--rule); border-radius: 6px; background: var(--card); overflow: hidden; }
.fmlp .fml-doc header { padding: 6px 12px; background: var(--chrome); border-bottom: 1px solid var(--rule); font: 12px var(--f-mono); }
.fmlp .fml-doc header button.inline { color: var(--soft); }
.fmlp .fml-code { margin: 0; padding: 8px 0; font: 12.5px/20px var(--f-mono); overflow-x: auto; }
.fmlp .fml-code .ln { display: flex; padding-right: 14px; }
.fmlp .fml-code .ln:hover { background: var(--chrome); }
.fmlp .fml-code .no { flex: none; width: 44px; padding-right: 12px; text-align: right; color: var(--faint); user-select: none; }
.fmlp .fml-code .src { white-space: pre; }
.fmlp .t-c { color: var(--faint); font-style: italic; }
.fmlp .t-s { color: var(--s3); }
.fmlp .t-p { color: var(--s2); }
.fmlp .t-k { color: var(--var-ink); font-weight: 600; }
.fmlp .t-f { color: var(--accent); }
.fmlp .t-n { color: var(--s5); }
.fmlp .t-b, .fmlp .t-o { color: var(--soft); }

/* ------------------------------------------------------------ a page: the library left, the format panel right */
.fmlp .library-search { padding: 8px 10px 2px; position: sticky; top: 0; background: var(--panel); z-index: 2; }
.fmlp .side.library .tree-section > header { top: 40px; }
.fmlp .side.format { border-right: 0; border-left: 1px solid var(--rule); padding: 0; display: grid; grid-template-rows: auto minmax(0, 1fr); overflow: hidden; }
.fmlp .builder-tabs { display: flex; border-bottom: 1px solid var(--rule); background: var(--chrome); }
.fmlp .builder-tabs button { flex: 1; border: 0; border-radius: 0; background: transparent; padding: 8px 10px 7px; font: 600 11px var(--f-display); text-transform: uppercase; letter-spacing: 0.06em; color: var(--soft); box-shadow: inset 0 -2px 0 transparent; }
.fmlp .builder-tabs button.on { color: var(--ink); box-shadow: inset 0 -2px 0 var(--accent); background: var(--panel); }
.fmlp .builder-body { overflow-y: auto; min-height: 0; padding: 12px 14px 16px; }
.fmlp .builder-body.flush { padding: 0 0 16px; }
.fmlp .library .palette { grid-template-columns: repeat(3, 1fr); padding: 2px 4px 6px; }
.fmlp .library .tile { padding: 8px 4px; font-size: 12px; gap: 4px; }
.fmlp .library .kind-filter { padding: 0 4px 6px; }
.fmlp .var-tools { display: flex; flex-direction: column; gap: 6px; padding: 0 4px 6px; }
.fmlp .search { width: 100%; padding: 5px 9px; border: 1px solid var(--rule); border-radius: 5px; background: var(--paper); font: 13px var(--f-display); color: var(--ink); }
.fmlp .kind-filter { display: flex; gap: 4px; }
.fmlp .kind-filter button { flex: 1; padding: 2px 4px; font: 600 11px var(--f-display); letter-spacing: 0.04em; display: inline-flex; gap: 4px; justify-content: center; align-items: baseline; }
.fmlp .kind-filter button .n { font: 500 10px var(--f-num); color: var(--faint); }
.fmlp .kind-filter button.on { background: var(--sel); border-color: var(--accent-dim); color: var(--accent); }
.fmlp .on-doc { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); flex: none; }
.fmlp .dim-ctx .tree-row { gap: 6px; }
.fmlp .dim-ctx .tree-row.filtered .label { color: var(--accent); font-weight: 600; }
.fmlp .filter-pill { font: 500 11px var(--f-display); color: var(--accent); background: var(--sel); border: 1px solid var(--accent-dim); border-radius: 999px; padding: 0 7px; max-width: 110px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fmlp .dim-members { display: flex; flex-wrap: wrap; gap: 4px; padding: 2px 8px 8px 30px; }
.fmlp .dim-members .hint { flex-basis: 100%; margin: 0 0 2px; }
.fmlp .dim-members .member { padding: 1px 8px; border-radius: 999px; font: 12px var(--f-display); }
.fmlp .dim-members .member.on { background: var(--accent); border-color: var(--accent); color: var(--paper); }
.fmlp .page-settings .facts.compact { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px 8px; }
.fmlp .page-settings .facts dt { font-size: 9.5px; margin-bottom: 0; }
.fmlp .page-settings .facts dd { font-size: 13px; }
.fmlp .page-settings .filters { grid-template-columns: 1fr; }

/* ------------------------------------------------------------ the page tabs at the bottom */
.fmlp .tabbar { display: flex; align-items: stretch; min-width: 0; border-top: 1px solid var(--rule); background: var(--chrome); padding-bottom: env(safe-area-inset-bottom, 0px); }
.fmlp .page-tabs { display: flex; min-width: 0; overflow-x: auto; scrollbar-width: thin; flex: 0 1 auto; }
.fmlp .page-tab { display: flex; align-items: center; border-right: 1px solid var(--rule); flex: none; position: relative; }
.fmlp .page-tab.on { background: var(--paper); box-shadow: inset 0 2px 0 var(--accent); }
.fmlp .page-tab.drop-before { box-shadow: inset 3px 0 0 var(--accent); }
.fmlp .page-tab.drop-after { box-shadow: inset -3px 0 0 var(--accent); }
.fmlp .page-tab .tab-name { border: 0; background: transparent; border-radius: 0; padding: 0 4px 0 12px; height: 100%; font: 400 13px var(--f-display); color: var(--soft); white-space: nowrap; max-width: 220px; overflow: hidden; text-overflow: ellipsis; position: relative; }
.fmlp .page-tab.model-tab .tab-name { padding-right: 12px; font-weight: 600; }
.fmlp .page-tab.on .tab-name { color: var(--ink); }
.fmlp .page-tab .tab-name .badge-dot { top: 6px; right: 0; }
.fmlp .page-tab .tab-menu { border: 0; background: transparent; padding: 0 8px 0 4px; height: 100%; color: var(--faint); font-size: 11px; border-radius: 0; }
.fmlp .page-tab .tab-menu:hover:not(:disabled) { color: var(--ink); }
.fmlp .tab-rename { margin: 4px 6px; width: 160px; padding: 2px 6px; border: 1px solid var(--accent-dim); border-radius: 4px; background: var(--card); font: 13px var(--f-display); }
.fmlp .tabbar > .icon { border-radius: 0; padding: 0 12px; font-size: 16px; flex: none; }
.fmlp .tab-status { margin-left: auto; display: flex; align-items: center; gap: 12px; padding: 0 12px; font: 11.5px var(--f-num); color: var(--soft); white-space: nowrap; flex: none; }
.fmlp .status-item { border: 0; background: transparent; padding: 0; font: inherit; color: inherit; display: inline-flex; align-items: center; gap: 6px; border-radius: 0; }
.fmlp button.status-item:hover:not(:disabled) { color: var(--ink); }
.fmlp .status-item.warn { color: var(--warn); }
.fmlp .pages-list { position: fixed; z-index: 35; bottom: calc(var(--tabbar-h) + 6px); width: min(360px, calc(100vw - 16px)); max-height: min(60vh, 520px); display: grid; grid-template-rows: auto minmax(0, 1fr); background: var(--card); border: 1px solid var(--rule); border-radius: 8px; box-shadow: 0 10px 28px rgba(0, 0, 0, 0.16); }
.fmlp .pages-list > .search { margin: 8px; width: auto; }
.fmlp .pages-list-body { overflow-y: auto; padding: 0 6px 8px; }
.fmlp .pages-list h3 { margin: 8px 0 2px; padding: 0 8px; display: flex; align-items: center; gap: 6px; font: 600 11px var(--f-display); text-transform: uppercase; letter-spacing: 0.06em; color: var(--soft); }
.fmlp .pages-row { display: flex; align-items: center; }
.fmlp .pages-row.on .tree-row { background: var(--sel); color: var(--accent); }

/* ------------------------------------------------------------ dialogs, toasts */
.fmlp .dialog:focus { outline: none; }
.fmlp .dialog.small { width: min(460px, 100%); }
.fmlp .dialog.wide { width: min(820px, 100%); }
.fmlp .dialog.find { width: min(560px, 100%); gap: 8px; }
.fmlp .dialog-body { display: flex; flex-direction: column; gap: 10px; }
.fmlp .dialog-body.form { flex-direction: row; }
.fmlp .dialog-actions { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.fmlp .dialog .form textarea { width: 100%; }
.fmlp .dialog fieldset { border: 1px solid var(--rule); border-radius: 6px; padding: 8px 10px; }
.fmlp .dialog .map-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.fmlp .dialog .map-grid label { display: flex; flex-direction: column; gap: 3px; }
.fmlp .search.big { padding: 8px 12px; font-size: 15px; }
.fmlp .find-list { list-style: none; margin: 0; padding: 0; max-height: 50vh; overflow-y: auto; }
.fmlp .find-list li { display: flex; align-items: center; gap: 8px; padding: 6px 10px; border-radius: 5px; cursor: pointer; min-width: 0; }
.fmlp .find-list li.active { background: var(--sel); color: var(--accent); }
.fmlp .find-list .label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fmlp .find-list .kind { font: 600 10px var(--f-display); text-transform: uppercase; letter-spacing: 0.06em; color: var(--faint); }
.fmlp .find-list .meta { font: 11px var(--f-num); color: var(--faint); }
.fmlp .shortcuts { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 4px 24px; margin: 0; }
.fmlp .shortcuts > div { display: flex; justify-content: space-between; gap: 10px; padding: 3px 0; border-bottom: 1px dashed var(--rule); }
.fmlp .shortcuts dd { margin: 0; }
.fmlp .shortcuts kbd { font-size: 12px; opacity: 1; color: var(--soft); }
.fmlp .guide-text { white-space: pre-wrap; font: 12.5px/1.55 var(--f-mono); background: var(--card); border: 1px solid var(--rule); border-radius: 6px; padding: 12px 14px; max-height: 62vh; overflow-y: auto; }
.fmlp .prose ul { padding-left: 18px; }
.fmlp .prose li { margin: 6px 0; }
.fmlp .toast { position: fixed; z-index: 45; left: 50%; transform: translateX(-50%); bottom: calc(var(--tabbar-h) + 14px); max-width: min(640px, calc(100vw - 32px)); display: flex; align-items: center; gap: 10px; padding: 8px 8px 8px 14px; background: var(--ink); color: var(--paper); border-radius: 7px; box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2); font-size: 13px; }
.fmlp .toast button.icon { color: var(--paper); }
.fmlp .toast button.icon:hover:not(:disabled) { background: transparent; color: var(--paper); border-color: transparent; opacity: 0.8; }
.fmlp .connect-btn { flex: none; }

/* A file's own menu in the editor (Delete lives there, away from Apply). */
.fmlp .file-more { position: relative; display: inline-flex; align-items: center; gap: 8px; }
.fmlp .file-menu { position: absolute; top: calc(100% + 4px); left: 0; z-index: 30; min-width: 180px; padding: 4px; background: var(--card); border: 1px solid var(--rule); border-radius: 7px; box-shadow: 0 10px 28px rgba(0, 0, 0, 0.16); }
.fmlp .file-menu button { display: block; width: 100%; text-align: left; border: 0; background: transparent; padding: 6px 10px; border-radius: 5px; font: 13px var(--f-display); }
.fmlp .file-menu button:hover { background: var(--sel); }
.fmlp .file-menu button.danger { color: var(--bad); }
/* The period on a page's filter bar, unset: a quiet invitation. */
.fmlp .doc-filter.period.unset, .fmlp .doc-filter.compare.unset { border-style: dashed; }

/* A custom block: its frame takes the width; the height is the content's (or the block's own). */
.fmlp .custom-block iframe { display: block; width: 100%; border: 0; background: transparent; color-scheme: normal; }
.fmlp .code-input { font: 12px/1.5 var(--f-mono); tab-size: 2; white-space: pre; }
.fmlp .glyph.block-html { border: 0; background: none; width: auto; min-width: 14px; height: auto; }
.fmlp .glyph.block-html::before { content: "</>"; font: 600 10px/1 var(--f-mono); color: var(--s3, var(--accent)); letter-spacing: -0.5px; }

/* A grid page (ui/grid.ts): react-grid-layout's own rules, then the blocks filling their cells. */
.fmlp .react-grid-layout { position: relative; transition: height 200ms ease; }
.fmlp .react-grid-item { transition: transform 200ms ease, width 200ms ease, height 200ms ease; box-sizing: border-box; }
.fmlp .react-grid-item.cssTransforms { transition-property: transform, width, height; }
.fmlp .react-grid-item.resizing, .fmlp .react-grid-item.react-draggable-dragging { transition: none; z-index: 3; will-change: transform; }
.fmlp .react-grid-item.react-grid-placeholder { background: var(--accent); opacity: 0.12; border-radius: 8px; transition-duration: 100ms; z-index: 2; user-select: none; }
.fmlp .react-grid-item > .react-resizable-handle { position: absolute; width: 18px; height: 18px; right: 2px; bottom: 2px; cursor: se-resize; z-index: 4; }
.fmlp .react-grid-item > .react-resizable-handle::after { content: ""; position: absolute; right: 4px; bottom: 4px; width: 7px; height: 7px; border-right: 2px solid var(--faint); border-bottom: 2px solid var(--faint); border-radius: 0 0 2px 0; }
.fmlp .page-ws.viewing .react-resizable-handle { display: none; }
.fmlp .doc.grid-doc { max-width: 1400px; }
.fmlp .grid-cell > .blk { height: 100%; margin: 0; padding: 8px 10px; display: flex; flex-direction: column; overflow: auto; background: var(--paper); }
.fmlp .page-ws.viewing .grid-cell > .blk { padding: 4px 2px; }
.fmlp .grid-cell > .blk > figure, .fmlp .grid-cell > .blk > .md { flex: 1; min-height: 0; margin: 0; display: flex; flex-direction: column; }
.fmlp .grid-cell > .blk .chart-box { flex: 1; height: auto; min-height: 120px; }
.fmlp .grid-cell > .blk > figure.kpi { justify-content: center; }
.fmlp .grid-cell > .blk .blk-tools { top: 4px; right: 6px; }
.fmlp .blk-drag { cursor: grab; padding: 0 5px; color: var(--soft); font-size: 13px; user-select: none; }
.fmlp .blk-drag:active { cursor: grabbing; }
.fmlp .field-label { display: block; font-size: 12px; color: var(--soft); margin-bottom: 4px; }
/* A KPI's wrapper carries the class kpi too: on the grid it is only the cell, the card is the figure. */
.fmlp .grid-cell > .blk.kpi { padding: 0; background: transparent; border-color: transparent; box-shadow: none; }
.fmlp .page-ws.editing .grid-cell > .blk.kpi:hover { border-color: var(--rule); }
.fmlp .grid-cell > .blk.kpi.selected, .fmlp .page-ws.editing .grid-cell > .blk.kpi.selected:hover { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-dim); }
.fmlp .chart-notes { margin: 4px 0 0; font: 11px var(--f-display); color: var(--faint); }

/* IBCS: a KPI's comparison, and the IBCS table's variance columns and bars. */
.fmlp .kpi-vs { font: 600 12px var(--f-num); margin-top: 2px; color: var(--soft); }
.fmlp .kpi-vs.up, .fmlp .ibcs-table td.up, .fmlp td.cmp.up { color: var(--good); }
.fmlp .kpi-vs.down, .fmlp .ibcs-table td.down { color: var(--bad); }
.fmlp .ibcs-table td.base { color: var(--soft); }
.fmlp .ibcs-table .bar-col { width: 140px; min-width: 120px; }
.fmlp .ibcs-table .vbar { position: relative; display: block; height: 10px; border-left: 0; }
.fmlp .ibcs-table .vbar::before { content: ""; position: absolute; left: 50%; top: -3px; bottom: -3px; border-left: 1px solid var(--ink); }
.fmlp .ibcs-table .vbar i { position: absolute; top: 0; height: 100%; }
.fmlp .ibcs-table .vbar i.up { background: var(--good); }
.fmlp .ibcs-table .vbar i.down { background: var(--bad); }

/* ------------------------------------------------------------------ Graphite (tokens.css, DESIGN.md) */
/* Series: an ordered palette a colour-blind reader tells apart (blue, orange, green, violet, teal, raspberry, ochre). */
:root[data-look="graphite"] .fmlp {
  --s1: #2f5bd8; --s2: #e8710a; --s3: #1f8a48; --s4: #7b4ddb; --s5: #0b8a9a; --s6: #c23b74; --s7: #9a7b0a; --s8: var(--faint);
  --warn: #c27a00;
  font-feature-settings: "cv11", "ss01";
  /* Numbers in the interface's face, figures of one width; mono is for code. */
  --f-num: var(--f-display);
}
@media (prefers-color-scheme: dark) {
  :root[data-look="graphite"]:not([data-theme="light"]) .fmlp { --s1: #7b9cff; --s2: #ff9a4d; --s3: #5cc98a; --s4: #a98bff; --s5: #4cc6d4; --s6: #f07aa8; --s7: #d9b84a; --warn: #f0b44c; }
}
:root[data-look="graphite"][data-theme="dark"] .fmlp { --s1: #7b9cff; --s2: #ff9a4d; --s3: #5cc98a; --s4: #a98bff; --s5: #4cc6d4; --s6: #f07aa8; --s7: #d9b84a; --warn: #f0b44c; }
:root[data-look="graphite"] .fmlp .kpi-value { font-variant-numeric: tabular-nums; letter-spacing: -0.02em; font-weight: 600; }
:root[data-look="graphite"] .fmlp .mark { background: var(--ink); color: var(--card); }
:root[data-look="graphite"] .fmlp .md { font-family: var(--f-body); }
:root[data-look="graphite"] .fmlp .doc { box-shadow: 0 1px 2px rgba(16, 24, 40, 0.05); border-color: var(--rule); }
:root[data-look="graphite"] .fmlp .kpi, :root[data-look="graphite"] .fmlp .scroll, :root[data-look="graphite"] .fmlp .chart-box { border-color: var(--rule); }
:root[data-look="graphite"] .fmlp figcaption { letter-spacing: 0.02em; }
:root[data-look="graphite"] .fmlp .mark { font-family: var(--f-display); letter-spacing: -0.02em; }

/* The page's comparison (ui/compare.ts): a table's columns against it, the chip that sets it. */
.fmlp td.cmp.up { color: var(--good); }
.fmlp td.cmp.down { color: var(--bad); }
.fmlp td.cmp.base { color: var(--soft); }
.fmlp th.cmp.first, .fmlp td.cmp.first { border-left: 1px solid var(--rule); }
.fmlp .doc-filter.compare select + select { margin-left: 2px; }
.fmlp .doc-filter.compare button.ytd { border: 1px solid var(--accent-dim); background: var(--card); color: var(--soft); border-radius: 999px; padding: 0 8px; font: 500 11.5px var(--f-display); margin-left: 4px; }
.fmlp .doc-filter.compare button.ytd.on { background: var(--accent); border-color: var(--accent); color: var(--card); }

/* Model › Copy data (ui/copy-dialog.tsx) */
.fmlp .copy-sides { display: flex; align-items: stretch; gap: 10px; flex-wrap: wrap; }
.fmlp .copy-side { flex: 1 1 220px; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; min-width: 0; }
.fmlp .copy-arrow { align-self: center; font-size: 20px; color: var(--faint); }
.fmlp .copy-scope { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.fmlp .copy-counts { width: 100%; font-family: var(--f-num); font-variant-numeric: tabular-nums; }
.fmlp .copy-counts td, .fmlp .copy-counts th { text-align: right; padding: 3px 8px; }
.fmlp .copy-counts th:nth-child(2), .fmlp .copy-counts td:first-child { text-align: left; }
.fmlp .copy-counts tr.off { color: var(--faint); }

/* A top-down entry onto nothing asks for its shape (ui/spread.tsx). */
.fmlp .spread-ask { margin-top: 8px; padding: 10px 12px; border: 1px solid var(--accent-dim); background: var(--sel); border-radius: 8px; display: flex; flex-direction: column; gap: 8px; }
.fmlp .spread-ask p { margin: 0; font-size: 13px; color: var(--ink); }
.fmlp .spread-choices { display: flex; flex-wrap: wrap; gap: 6px; }
.fmlp .empty-start { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0 0 8px; padding: 8px 10px; border: 1px dashed var(--accent-dim); border-radius: 8px; background: var(--sel); font-size: 13px; }
.fmlp .empty-start label { display: inline-flex; align-items: center; gap: 4px; color: var(--soft); }
.fmlp .empty-start input { width: 48px; text-align: right; }

/* The Planning tab (ui/planning-view.tsx) */
.fmlp .planning { overflow: auto; height: 100%; padding: 20px 24px 40px; display: flex; flex-direction: column; gap: 18px; }
.fmlp .plan-card { background: var(--card); border: 1px solid var(--rule); border-radius: 10px; padding: 16px 18px; display: flex; flex-direction: column; gap: 14px; max-width: 1180px; width: 100%; margin: 0 auto; }
.fmlp .plan-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; }
.fmlp .plan-head h2 { margin: 0; font: 700 17px var(--f-display); }
.fmlp .plan-head .meta, .fmlp .plan-reco .meta { color: var(--soft); font-size: 12.5px; font-weight: 400; }
.fmlp .plan-grid { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(240px, 1fr); gap: 14px; }
@media (max-width: 1000px) { .fmlp .plan-grid { grid-template-columns: 1fr; } }
.fmlp .plan-chart { margin: 0; border: 1px solid var(--rule); border-radius: 8px; padding: 6px 6px 2px; min-width: 0; }
.fmlp .plan-chart svg { width: 100%; height: auto; display: block; }
.fmlp .plan-chart .grid { stroke: var(--rule); }
.fmlp .plan-chart .tick { font: 10px var(--f-num); fill: var(--soft); }
.fmlp .plan-chart .tick.year { fill: var(--ink); font-weight: 600; }
.fmlp .plan-chart .horizon { fill: var(--accent-soft); opacity: .45; }
.fmlp .plan-chart .band { fill: color-mix(in srgb, var(--s1) 14%, transparent); }
.fmlp .plan-chart .alt { fill: none; stroke: var(--faint); stroke-width: 1.2; stroke-dasharray: 4 3; }
.fmlp .plan-chart .actual { fill: none; stroke: var(--ink); stroke-width: 2; }
.fmlp .plan-chart .plan { fill: none; stroke: var(--s1); stroke-width: 2.4; }
.fmlp .plan-chart .scen { fill: none; stroke-width: 2; }
.fmlp .plan-chart .scen.s0 { stroke: var(--s1); } .fmlp .plan-chart .scen.s1 { stroke: var(--s2); } .fmlp .plan-chart .scen.s2 { stroke: var(--s4); } .fmlp .plan-chart .scen.s3 { stroke: var(--s5); }
.fmlp .plan-chart .legend { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 12px; color: var(--soft); padding: 2px 6px 4px; }
.fmlp .plan-chart .legend i { display: inline-block; width: 14px; height: 0; border-top: 2px solid var(--ink); vertical-align: middle; margin-right: 5px; }
.fmlp .plan-chart .legend i.plan, .fmlp .plan-chart .legend i.s0 { border-color: var(--s1); }
.fmlp .plan-chart .legend i.alt { border-color: var(--faint); border-top-style: dashed; }
.fmlp .plan-chart .legend i.s1 { border-color: var(--s2); } .fmlp .plan-chart .legend i.s2 { border-color: var(--s4); } .fmlp .plan-chart .legend i.s3 { border-color: var(--s5); }
.fmlp .plan-reco { border: 1px solid var(--accent-dim); background: var(--sel); border-radius: 8px; padding: 12px 14px; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.fmlp .plan-reco .k { font: 600 11px var(--f-display); text-transform: uppercase; letter-spacing: .07em; color: var(--accent); }
.fmlp .plan-reco h3 { margin: 0; font-size: 15px; }
.fmlp .plan-reco ul { margin: 0; padding-left: 18px; }
.fmlp .plan-reco p { margin: 0; }
.fmlp .plan-reco .nums { display: flex; flex-wrap: wrap; gap: 16px; margin-top: 4px; font-variant-numeric: tabular-nums; }
.fmlp .plan-reco .nums b { display: block; font-size: 18px; letter-spacing: -.02em; }
.fmlp .plan-reco .nums span { font-size: 12px; color: var(--soft); }
.fmlp .plan-card .bad { color: var(--bad); }
.fmlp .plan-label { font: 600 11px var(--f-display); text-transform: uppercase; letter-spacing: .07em; color: var(--soft); margin: 0 0 6px; }
.fmlp .plan-methods { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 8px; }
.fmlp .plan-method { text-align: left; display: flex; flex-direction: column; gap: 3px; padding: 8px 10px; border-radius: 8px; min-width: 0; font-weight: 400; }
.fmlp .plan-method[aria-pressed="true"] { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.fmlp .plan-method .t { font-weight: 600; display: flex; justify-content: space-between; gap: 6px; }
.fmlp .plan-method .sub { font-size: 12px; color: var(--soft); font-variant-numeric: tabular-nums; }
.fmlp .plan-method .spark { width: 100%; height: 26px; }
.fmlp .plan-method .spark path { fill: none; stroke: var(--s1); stroke-width: 1.6; }
.fmlp .badge-rec { font: 600 10px var(--f-display); color: var(--card); background: var(--accent); border-radius: 4px; padding: 1px 5px; text-transform: uppercase; letter-spacing: .04em; }
.fmlp .plan-dists { display: flex; flex-wrap: wrap; gap: 6px; }
.fmlp .plan-dists button { border-radius: 999px; font-weight: 400; }
.fmlp .plan-dists button[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--card); }
.fmlp .plan-rules { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.fmlp .plan-rule { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--rule); border-radius: 8px; padding: 3px 8px; font-size: 13px; }
.fmlp .plan-rule input { width: 52px; text-align: right; padding: 2px 6px; border: 1px solid var(--rule); border-radius: 5px; background: var(--paper); font-variant-numeric: tabular-nums; }
.fmlp .plan-table { width: 100%; }
.fmlp .plan-table td, .fmlp .plan-table th { text-align: right; padding: 5px 10px; white-space: nowrap; }
.fmlp .plan-table th:first-child, .fmlp .plan-table td.label { text-align: left; }
.fmlp .plan-table td.up { color: var(--good); } .fmlp .plan-table td.down { color: var(--bad); }
.fmlp .plan-cont { border-radius: 8px; padding: 8px 12px; font-size: 13px; }
.fmlp .plan-cont.ok { background: color-mix(in srgb, var(--good) 12%, transparent); color: var(--good); }
.fmlp .plan-cont.off { background: color-mix(in srgb, var(--warn) 14%, transparent); color: var(--warn); }
.fmlp .plan-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; border-top: 1px solid var(--rule); padding-top: 12px; }
.fmlp .plan-actions label { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; }
.fmlp .plan-actions .hint { margin-left: auto; }
.fmlp .plan-done { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; border: 1px solid var(--good); background: color-mix(in srgb, var(--good) 10%, transparent); border-radius: 8px; padding: 8px 12px; font-size: 13px; }
.fmlp .plan-done b { color: var(--good); }
.fmlp .planning-tab .tab-name { color: var(--accent); font-weight: 500; }
.fmlp .plan-chart { align-self: start; }
.fmlp .plan-chart.scen-chart { max-width: 760px; }
.fmlp .plan-table th.label { text-align: left; }
.fmlp .plan-reco p.meta { margin: 0; }

/* The pivot table (ui/pivot-view.tsx) */
.fmlp .pivot { display: flex; flex-direction: column; min-height: 0; height: 100%; }
.fmlp .pivot-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; min-height: 0; font-size: 12px; }
.fmlp .pivot-bar:empty { display: none; }
.fmlp .pivot-bar .quiet { padding: 1px 6px; font-size: 12px; }
.fmlp .pivot-stats { margin-left: auto; display: inline-flex; align-items: center; gap: 6px; color: var(--soft); font-variant-numeric: tabular-nums; }
.fmlp .quick-input { width: 90px; padding: 2px 6px; font-size: 12px; border: 1px solid var(--accent); border-radius: 4px; }
.fmlp .pivot-scroll { overflow: auto; max-height: 560px; border: 1px solid var(--rule); border-radius: 6px; outline: none; position: relative; flex: 1 1 auto; min-height: 60px; }
.fmlp .grid-cell .pivot-scroll { max-height: none; }
.fmlp .pivot-scroll:focus-visible { box-shadow: 0 0 0 2px var(--accent-dim); }
.fmlp .pivot table { border-collapse: separate; border-spacing: 0; width: max-content; min-width: 100%; }
.fmlp .pivot thead th { position: sticky; top: 0; z-index: 2; background: var(--chrome); height: 28px; }
.fmlp .pivot thead tr:nth-child(2) th { top: 28px; }
.fmlp .pivot thead th.group-head { text-align: center; border-bottom: 1px solid var(--rule); }
.fmlp .pivot th.corner { left: 0; z-index: 3; text-align: left; color: var(--soft); font-weight: 500; }
.fmlp .pivot tbody th { position: sticky; left: 0; z-index: 1; background: var(--card); text-align: left; white-space: nowrap; font-weight: 500; border-right: 1px solid var(--rule); }
.fmlp .pivot tbody tr.group th, .fmlp .pivot tbody tr.group td { font-weight: 600; }
.fmlp .pivot tbody tr.group td:not(.input) { background: color-mix(in srgb, var(--chrome) 55%, var(--card)); }
.fmlp .pivot tbody tr.total th, .fmlp .pivot tbody tr.total td { font-weight: 700; border-top: 1px solid var(--soft); }
.fmlp .pivot td { text-align: right; white-space: nowrap; padding: 0 9px; border-bottom: 1px solid var(--rule); cursor: cell; user-select: none; }
.fmlp .pivot td.sel { background: color-mix(in srgb, var(--accent) 26%, var(--card)) !important; }
.fmlp .pivot td.active { box-shadow: inset 0 0 0 2px var(--accent); }
.fmlp .pivot tr.spacer td { padding: 0; border: 0; }
.fmlp .pivot .fold { border: 0; background: transparent; padding: 0 4px 0 0; width: 16px; color: var(--soft); font-size: 11px; cursor: pointer; }
.fmlp .pivot .fold-pad { display: inline-block; width: 16px; }
.fmlp .pivot-editor { width: 100%; min-width: 70px; border: 0; outline: none; background: var(--card); text-align: right; font: inherit; padding: 0; }
.fmlp .axis-edit { display: flex; flex-direction: column; gap: 4px; }
.fmlp .pivot table { table-layout: fixed; }
.fmlp .pivot td, .fmlp .pivot th { overflow: hidden; text-overflow: ellipsis; }
.fmlp .pivot-scroll { contain: content; overscroll-behavior: contain; }

/* A copy for sharing (ui/share-banner.tsx) */
.fmlp .share-banner { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; padding: 10px 16px; background: var(--sel); border-bottom: 1px solid var(--accent-dim); font-size: 13px; }
.fmlp .share-banner .share-text { flex: 1 1 420px; min-width: 0; }
.fmlp .share-banner .bad { color: var(--bad); }
.fmlp .share-actions { display: flex; gap: 8px; }

/* Model › Imports (ui/imports-view.tsx) */
.fmlp .imports-ws { display: grid; grid-template-columns: 270px minmax(0, 1fr); height: 100%; min-height: 0; }
@media (max-width: 860px) { .fmlp .imports-ws { grid-template-columns: 1fr; } }
.fmlp .imports-list { display: flex; flex-direction: column; gap: 8px; padding: 14px 12px; overflow: auto; border-right: 1px solid var(--rule); }
.fmlp .imp-row { text-align: left; display: flex; flex-direction: column; gap: 2px; padding: 8px 10px; border-radius: 8px; font-weight: 400; }
.fmlp .imp-row.on { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.fmlp .imp-row b { font-size: 13.5px; }
.fmlp .imp-row span { font-size: 12px; color: var(--soft); }
.fmlp .pill { font: 600 10.5px var(--f-display); border-radius: 4px; padding: 1px 6px; text-transform: uppercase; letter-spacing: .04em; background: var(--chrome); color: var(--soft); }
.fmlp .pill.ok { background: color-mix(in srgb, var(--good) 14%, transparent); color: var(--good); }
.fmlp .pill.warn { background: color-mix(in srgb, var(--warn) 16%, transparent); color: var(--warn); }
.fmlp .pill.new { background: var(--accent-soft); color: var(--accent); }
.fmlp .dropped { display: flex; flex-direction: column; gap: 4px; }
.fmlp .imports-main { overflow: auto; padding: 18px 22px 40px; min-width: 0; }
.fmlp .imp-detail { max-width: 1180px; }
.fmlp .imp-detail .spacer { flex: 1; }
.fmlp .imp-title { margin: 0; font-size: 17px; }
.fmlp .imp-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 12px; }
.fmlp .imp-card { border: 1px solid var(--rule); border-radius: 10px; padding: 12px 14px; display: flex; flex-direction: column; gap: 10px; min-width: 0; background: var(--card); }
.fmlp .imp-drop { border: 1.5px dashed var(--accent-dim); background: var(--sel); border-radius: 8px; padding: 10px 12px; display: flex; flex-direction: column; gap: 8px; font-size: 13px; }
.fmlp .imp-card .kv, .fmlp .imp-drop .kv { display: grid; grid-template-columns: 90px minmax(0, 1fr); gap: 4px 10px; font-size: 13px; }
.fmlp .imp-card .kv .k, .fmlp .imp-drop .kv .k { color: var(--soft); }
.fmlp .imp-card .row, .fmlp .imp-drop .row, .fmlp .imp-unknown .row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.fmlp .imp-drop input.pattern { width: 180px; font: 12.5px var(--f-mono); padding: 2px 6px; border: 1px solid var(--rule); border-radius: 4px; }
.fmlp .imp-code { max-height: 220px; overflow: auto; background: var(--chrome); border-radius: 6px; padding: 8px 10px; white-space: pre; }
.fmlp .imp-map td.map { color: var(--accent); font-weight: 500; }
.fmlp .imp-map td.faint { color: var(--faint); }
.fmlp .imp-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(100px, 1fr)); gap: 8px; }
.fmlp .imp-stats .stat { border: 1px solid var(--rule); border-radius: 8px; padding: 6px 10px; }
.fmlp .imp-stats .stat b { display: block; font-size: 17px; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.fmlp .imp-stats .stat b.up { color: var(--good); } .fmlp .imp-stats .stat b.down { color: var(--bad); } .fmlp .imp-stats .stat b.warn { color: var(--warn); }
.fmlp .imp-stats .stat span { font-size: 12px; color: var(--soft); }
.fmlp .imp-unknown { border: 1px solid var(--warn); background: color-mix(in srgb, var(--warn) 10%, transparent); border-radius: 8px; padding: 10px 12px; display: flex; flex-direction: column; gap: 8px; font-size: 13px; }
.fmlp .imp-unknown code { background: var(--card); border-radius: 4px; padding: 1px 6px; }
