/* LeonSim Pro shell: the look of an engineering workstation (Ansys, SolidWorks, STAR-CCM+) for the app pages.
   A graphite chrome, sentence-case Geist for the interface, Geist Mono for numbers only, one selection blue, and the
   shared pieces: the title bar with the page switcher, the command ribbon, docked panes (a tree over a property grid),
   the viewport furniture (heads-up toolbar, view cube, triad, scale) and the status bar.  The page's own CSS lays
   them out.  See docs/design-review in the project files for the reasoning. */
:root {
  color-scheme: dark;
  --chrome: #16181b;  --panel: #1d2024;  --panel-2: #23272c;  --well: #121417;
  --line: #2c3036;    --line-2: #3a3f46;
  --ink: #e6e9ed;     --ink-2: #b4bac2;  --muted: #7d858f;
  --accent: #4ea1ff;  --accent-ink: #fff; --accent-soft: rgba(78, 161, 255, 0.14); --accent-line: rgba(78, 161, 255, 0.45);
  --brand: #7cf0ff;
  --ok: #5fd08a;  --ok-soft: rgba(95, 208, 138, 0.13);
  --warn: #f0b04f; --warn-soft: rgba(240, 176, 79, 0.13);
  --crit: #ff6b62; --crit-soft: rgba(255, 107, 98, 0.13);
  --vp-top: #3b4552;  --vp-bot: #101215;
  --font: "Geist", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --mono: "Geist Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  /* names the older page CSS reads */
  --bg: var(--well); --font-body: var(--font); --font-display: var(--font); --font-mono: var(--mono);
  --viewport: var(--vp-bot); --radius: 4px;
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { background: var(--chrome); color: var(--ink); font: 400 12.5px/1.4 var(--font); letter-spacing: -0.003em; -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
::selection { background: rgba(78, 161, 255, 0.35); }
* { scrollbar-color: rgba(255, 255, 255, 0.16) transparent; scrollbar-width: thin; }
.num { font-family: var(--mono); font-variant-numeric: tabular-nums; }
svg.i { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; flex: none; }
kbd { font: 500 10px/1 var(--mono); border: 1px solid var(--line-2); border-bottom-width: 2px; border-radius: 3px; padding: 1px 4px; color: var(--ink-2); background: var(--well); }

/* ---------------------------------------------------------------- controls */
.pbtn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 26px; padding: 0 10px; cursor: pointer;
  border: 1px solid var(--line-2); border-radius: 4px; background: var(--panel-2); color: var(--ink); font-weight: 500; white-space: nowrap;
}
.pbtn:hover { border-color: #565d66; background: #2a2f35; }
.pbtn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.pbtn.primary:hover { background: #69b0ff; }
.pbtn[disabled], .cmd[disabled], .cmd[aria-disabled="true"] { opacity: 0.4; cursor: default; pointer-events: none; }
.ibtn { width: 28px; height: 26px; display: inline-grid; place-items: center; border: 0; border-radius: 4px; background: transparent; color: var(--ink-2); cursor: pointer; padding: 0; }
.ibtn:hover { background: rgba(255, 255, 255, 0.07); color: var(--ink); }
.ibtn[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent); }
.pseg { display: inline-flex; border: 1px solid var(--line-2); border-radius: 4px; overflow: hidden; background: var(--well); }
.pseg button { border: 0; background: transparent; color: var(--ink-2); padding: 3px 9px; cursor: pointer; font-size: 11.5px; }
.pseg button + button { border-left: 1px solid var(--line); }
.pseg button:hover { color: var(--ink); background: rgba(255, 255, 255, 0.05); }
.pseg button[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent); }
input[type="number"], input[type="text"], select {
  height: 22px; padding: 0 6px; border: 1px solid var(--line); border-radius: 3px; background: var(--well); color: var(--ink);
  font: 400 11.5px/1 var(--mono); min-width: 0;
}
input[type="number"]:hover, input[type="text"]:hover, select:hover { border-color: var(--line-2); }
input[type="number"]:focus, input[type="text"]:focus, select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }
select {
  appearance: none; -webkit-appearance: none; padding-right: 20px; cursor: pointer; font-family: var(--font);
  background: var(--well) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%237d858f' stroke-width='1.4' fill='none'/%3E%3C/svg%3E") no-repeat right 6px center / 8px 5px;
}
input[type="checkbox"] { accent-color: var(--accent); margin: 0; }

/* ---------------------------------------------------------------- title bar */
.tb { display: flex; align-items: center; gap: 12px; height: 36px; padding: 0 10px; background: var(--chrome); border-bottom: 1px solid var(--line); min-width: 0; }
.tb .logo { display: flex; align-items: center; gap: 8px; font: 600 12px/1 var(--font); letter-spacing: 0.14em; color: var(--ink); text-decoration: none; flex: none; }
.tb .logo i { width: 18px; height: 18px; border-radius: 4px; background: #000; display: grid; place-items: center; box-shadow: 0 0 0 1px var(--line-2); }
.apps { display: flex; gap: 2px; padding: 2px; border: 1px solid var(--line); border-radius: 6px; background: var(--well); flex: none; }
.apps a { padding: 3px 10px; border-radius: 4px; color: var(--muted); text-decoration: none; font-weight: 500; white-space: nowrap; }
.apps a:hover { color: var(--ink); }
.apps a[aria-current="page"] { background: var(--panel-2); color: var(--ink); box-shadow: 0 0 0 1px var(--line-2) inset; }
html[data-static] .apps a[data-server], html[data-static] a.cmd[data-server], html:not([data-static]) .apps a[data-demo] { display: none; }
.tb .sep { width: 1px; height: 18px; background: var(--line-2); flex: none; }
.tb .tools { display: flex; align-items: center; gap: 1px; flex: none; }
.tb .doc { display: flex; align-items: center; gap: 2px; min-width: 0; }
.tb .doc input { height: 24px; border-color: transparent; background: transparent; font: 600 12.5px/1 var(--font); field-sizing: content; min-width: 3rem; max-width: 16rem; padding: 0 4px; }
.tb .doc input:hover { border-color: var(--line); }
.tb .doc small { color: var(--muted); font: 400 11px var(--mono); white-space: nowrap; }
.tb .spacer { flex: 1; }
.job {
  display: flex; align-items: center; gap: 8px; min-width: 0; max-width: 40rem; height: 24px; padding: 0 10px 0 4px;
  border: 1px solid var(--line); border-radius: 6px; background: var(--well); color: var(--ink-2); font-size: 11.5px;
}
.job .dot { padding: 1px 7px; border-radius: 4px; font-weight: 500; background: var(--panel-2); color: var(--ink-2); flex: none; }
.job[data-state="idle"] .dot { display: none; }
.job[data-state="idle"] { padding-left: 10px; }
.job[data-state="running"] .dot, .job[data-state="queued"] .dot { background: var(--accent-soft); color: var(--accent); }
.job[data-state="running"] .dot::before { content: "Working"; }
.job[data-state="queued"] .dot::before { content: "Queued"; }
.job[data-state="done"] .dot { background: var(--ok-soft); color: var(--ok); }
.job[data-state="done"] .dot::before { content: "Done"; }
.job[data-state="error"] .dot { background: var(--crit-soft); color: var(--crit); }
.job[data-state="error"] .dot::before { content: "Error"; }
.job .txt { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------------------------------------------------------------- ribbon: captioned groups of commands */
.rb { display: flex; align-items: stretch; gap: 0; height: 84px; padding: 4px 4px 0; background: var(--panel); border-bottom: 1px solid var(--line); overflow-x: auto; overflow-y: hidden; scrollbar-width: none; }
.rb::-webkit-scrollbar { display: none; }
.rg { display: flex; flex-direction: column; padding: 0 6px; border-right: 1px solid var(--line); flex: none; }
.rg:last-child { border-right: 0; }
.rg > .cmds { display: flex; gap: 1px; align-items: flex-start; flex: 1; }
.rg > .cap { text-align: center; font-size: 10.5px; color: var(--muted); padding: 1px 0 4px; white-space: nowrap; }
.cmd {
  display: flex; flex-direction: column; align-items: center; gap: 3px; min-width: 50px; padding: 5px 6px 4px; cursor: pointer;
  border: 0; border-radius: 4px; background: transparent; color: var(--ink-2); font-size: 11.5px; white-space: nowrap; line-height: 1.15;
}
.cmd svg.i { width: 22px; height: 22px; stroke-width: 1.4; color: var(--ink); }
.cmd:hover { background: rgba(255, 255, 255, 0.06); color: var(--ink); }
.cmd[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent); box-shadow: 0 0 0 1px var(--accent-line) inset; }
.cmd[aria-pressed="true"] svg.i { color: var(--accent); }
.cmd.go { background: var(--accent); color: var(--accent-ink); }
.cmd.go svg.i { color: var(--accent-ink); }
.cmd.go:hover { background: #69b0ff; }
.rstack { display: flex; flex-direction: column; justify-content: center; gap: 2px; height: 100%; padding: 0 2px; }
.rstack .s {
  display: flex; align-items: center; gap: 6px; padding: 1px 6px; min-height: 20px; border: 0; border-radius: 4px; background: transparent;
  color: var(--ink-2); font-size: 11.5px; line-height: 1.2; cursor: pointer; white-space: nowrap; text-align: left;
}
.rstack .s:hover { background: rgba(255, 255, 255, 0.06); color: var(--ink); }
.rstack .s svg.i { width: 15px; height: 15px; }
.rstack label.s { cursor: default; }
.rstack label.s:hover { background: transparent; }
.rstack .s input[type="number"] { width: 5.2rem; margin-left: auto; }

/* ---------------------------------------------------------------- docked panes */
.dock { background: var(--panel); min-height: 0; min-width: 0; display: flex; flex-direction: column; }
.ph {
  display: flex; align-items: center; gap: 8px; height: 28px; padding: 0 10px; flex: none;
  background: var(--chrome); border-bottom: 1px solid var(--line); font-weight: 600; font-size: 11.5px; color: var(--ink-2);
}
* + .ph { border-top: 1px solid var(--line); }
.ph .r { margin-left: auto; color: var(--muted); font-weight: 400; font-family: var(--mono); font-size: 11px; }
.pbody { overflow: auto; min-height: 0; }
.hint { color: var(--muted); font-size: 11.5px; line-height: 1.45; margin: 0; }

/* the tree (STAR-CCM+ simulation tree, SolidWorks FeatureManager) */
.ptree { list-style: none; margin: 0; padding: 3px 0; }
.ptree ul { list-style: none; margin: 0; padding: 0; }
.ptree .node {
  display: flex; align-items: center; gap: 7px; height: 23px; padding: 0 8px 0 calc(10px + var(--d, 0) * 16px); cursor: pointer;
  color: var(--ink-2); white-space: nowrap; min-width: 0;
}
.ptree .node:hover { background: rgba(255, 255, 255, 0.04); color: var(--ink); }
.ptree .node[aria-selected="true"] { background: var(--accent-soft); color: var(--ink); box-shadow: 2px 0 0 var(--accent) inset; }
.ptree .tw { width: 9px; flex: none; color: var(--muted); font-size: 8px; text-align: center; }
.ptree .nm { overflow: hidden; text-overflow: ellipsis; flex: 1; }
.ptree .kd { color: var(--muted); font: 400 10.5px var(--mono); }
.ptree svg.i { width: 14px; height: 14px; color: var(--muted); }

/* the property grid (Ansys "Details of", SolidWorks PropertyManager) */
.pm-head { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-bottom: 1px solid var(--line); }
.pm-head svg.i { color: var(--accent); }
.pm-head b { font-size: 13px; font-weight: 600; }
.pm-head span { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pm-head .ok, .pm-head .no { width: 26px; height: 22px; display: grid; place-items: center; border: 0; border-radius: 4px; cursor: pointer; flex: none; padding: 0; }
.pm-head .ok { background: var(--ok-soft); color: var(--ok); margin-left: auto; }
.pm-head .no { background: var(--crit-soft); color: var(--crit); }
.pm-head .ok:hover { background: rgba(95, 208, 138, 0.25); }
.pm-head .no:hover { background: rgba(255, 107, 98, 0.25); }
.pg-cap { padding: 9px 10px 3px; font-size: 10.5px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; }
.pg-row { display: grid; grid-template-columns: 6.2rem minmax(0, 1fr); align-items: center; gap: 8px; min-height: 26px; padding: 2px 10px; border-bottom: 1px solid rgba(44, 48, 54, 0.6); }
.pg-row > .k { color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pg-row > .v { display: flex; align-items: center; gap: 4px; min-width: 0; flex-wrap: wrap; }
.pg-row > .v > input[type="number"], .pg-row > .v > input[type="text"] { flex: 1 1 0; width: 0; min-width: 3rem; }
.pg-row .u { color: var(--muted); font: 400 10.5px var(--mono); }
.pg-xyz { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 3px; width: 100%; }
.pg-xyz input { width: 100%; }
.pg-note { padding: 6px 10px; }

/* ---------------------------------------------------------------- viewport furniture */
.vp-hud {
  position: absolute; top: 8px; left: 50%; transform: translateX(-50%); z-index: 3; display: flex; align-items: center; gap: 1px; padding: 3px;
  border-radius: 7px; background: rgba(29, 32, 36, 0.86); border: 1px solid var(--line-2); box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
}
.vp-hud .sep { width: 1px; height: 18px; margin: 0 3px; background: var(--line-2); }
.vp-hud .pseg { background: transparent; border-color: transparent; }
.vp-hud .pseg button { padding: 3px 7px; }
.vp-hud .pseg button + button { border-left-color: transparent; }
.vp-title { position: absolute; top: 10px; left: 12px; z-index: 3; color: var(--ink-2); font-size: 11.5px; line-height: 1.45; pointer-events: none; text-shadow: 0 1px 3px rgba(0, 0, 0, 0.7); max-width: 30%; }
.vp-title b { display: block; color: var(--ink); font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vcube { position: absolute; top: 8px; right: 10px; z-index: 3; width: 84px; height: 84px; }
.vcube polygon { stroke: #8794a3; stroke-width: 0.8; cursor: pointer; }
.vcube polygon:hover { fill: #7fb6ff !important; }
.vcube text { font: 600 7.5px var(--font); fill: #1d2630; pointer-events: none; text-anchor: middle; dominant-baseline: middle; }
.vtriad { position: absolute; left: 10px; bottom: 8px; z-index: 3; width: 56px; height: 56px; pointer-events: none; }
.vtriad line { stroke-width: 2; stroke-linecap: round; }
.vtriad text { font: 500 9px var(--mono); dominant-baseline: middle; text-anchor: middle; }
.vruler { position: absolute; right: 12px; bottom: 10px; z-index: 3; font: 400 10.5px var(--mono); color: var(--ink-2); text-align: center; pointer-events: none; text-shadow: 0 1px 2px rgba(0, 0, 0, 0.7); }
.vruler i { display: block; height: 5px; margin-top: 2px; border: 1px solid var(--ink-2); border-top: 0; }
.ctxbar {
  position: absolute; z-index: 4; display: flex; gap: 1px; padding: 3px; border-radius: 6px; background: var(--panel-2);
  border: 1px solid var(--line-2); box-shadow: 0 8px 20px rgba(0, 0, 0, 0.45); transform: translate(-50%, -100%);
}

/* ---------------------------------------------------------------- status bar */
.sbar { display: flex; align-items: center; height: 24px; background: var(--chrome); border-top: 1px solid var(--line); font-size: 11px; color: var(--muted); min-width: 0; overflow: hidden; }
.sbar > * { display: flex; align-items: center; gap: 6px; height: 100%; padding: 0 10px; border-right: 1px solid var(--line); white-space: nowrap; flex: none; }
.sbar > .grow { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; display: block; line-height: 24px; border-right: 0; }
.sbar b { color: var(--ink-2); font-weight: 500; }
.sbar select { height: 18px; font-size: 11px; padding: 0 18px 0 5px; border-color: transparent; background-color: transparent; color: var(--ink-2); }
.sbar select:hover { border-color: var(--line-2); }
.sbar .tool { color: var(--ink); font-weight: 500; }
.sbar .tool::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); margin-right: 2px; }

/* ---------------------------------------------------------------- dialog (keyboard reference) */
.pdlg { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; background: rgba(0, 0, 0, 0.5); padding: 16px; }
.pdlg > div { width: min(34rem, 100%); max-height: 85vh; overflow: auto; background: var(--panel); border: 1px solid var(--line-2); border-radius: 8px; box-shadow: 0 24px 60px rgba(0, 0, 0, 0.6); }
.pdlg .ph { border-radius: 8px 8px 0 0; }
.pdlg dl { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; margin: 0; padding: 12px 14px 14px; }
.pdlg dt { white-space: nowrap; color: var(--ink); }
.pdlg dd { margin: 0; color: var(--ink-2); }
