/* CFX-Pre 2022 R1 web clone — measured layout.
 * Reference: /data/dev/ansys2202r1-work/shots/cfxpre-menu-edit-verified.png (1920x1080 RDP
 *   screenshot, maximized CFX-Pre). Capture contract: abs rows 22..1031 -> client 1920x1010.
 *   Every number below is a CLIENT coordinate (client y = abs y - 22), measured pixel by pixel.
 *
 * Vertical structure (client px), measured on the reference:
 *   0       1px  #F5F7F9  window/content top line
 *   1..18   18px menubar, white (labels' cap rows 6..14)
 *   19      1px  #F2F2F2  menuline
 *   20      1px  #FFFFFF
 *   21..44  24px toolbar band #F0F0F0; 16x16 icons at y=25, x per data/cfxpre.json
 *   45      1px  #BEBEBE  toolbar bottom edge
 *   46..48  3px  #EDEDED  workspace gap
 *   49..988 940px canvas block: 1px black frame x=3..1916, flat #808080 fill
 *   989..1009 21px status bar #F0F0F0 (11px text rows ~997..1005) + 3px bottom shade
 *
 * Horizontal: toolbar icons start at x=13 (first group separator x=3, then 265/582/951);
 *   last icon ends at x=1049; the remaining toolbar width is empty (as on the real window).
 */
:root {
  --cx-bg: #F0F0F0;
  --cx-menu-bg: #FFFFFF;
  --cx-canvas: #808080;
  --cx-status-bg: #F0F0F0;
  --cx-sep: #B9B9B9;
  --cx-tool-edge: #BEBEBE;
  --cx-gap: #EDEDED;
  --cx-hover: #DDEBF7;
  --cx-menu-hover: #CCE4F7;
  --cx-menu-border: #999999;
  /* CFX-Pre 2022 R1 is a Qt/Windows app: its UI font is the Windows system font
   * (Segoe UI), not the Rubik bundled by Fluent. Stack picks the real thing on
   * Windows viewers and the metric-closest available face (Carlito) in headless Linux. */
  --cx-font-ui: "Segoe UI", "Carlito", "Rubik", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0;
  width: 1920px; height: 1010px;
  overflow: hidden;
  background: var(--cx-bg);
}
body {
  font-family: var(--font-ui);
  font-size: 11px;
  color: #000;
  user-select: none;
  -webkit-font-smoothing: antialiased;
}
img { -webkit-user-drag: none; display: block; }

.win {
  position: relative;
  width: 1920px; height: 1010px;
  overflow: hidden;
  background: #F0F0F0;
}

/* ---------- stacked bands (all absolutely positioned: Qt fixed geometry) ---------- */
.topline   { position: absolute; left: 0; top: 0;   width: 1920px; height: 1px;  background: #F5F7F9; }
.menubar   { position: absolute; left: 0; top: 1px; width: 1920px; height: 18px;
             background: linear-gradient(to bottom, #FBFCFE 0px, #FFFFFF 5px); }
.menuline  { position: absolute; left: 0; top: 19px; width: 1920px; height: 1px; background: #F2F2F2; }
.menuwhite { position: absolute; left: 0; top: 20px; width: 1920px; height: 1px; background: #FFFFFF; }
.toolbar   { position: absolute; left: 0; top: 21px; width: 1920px; height: 24px; background: var(--cx-bg); }
.toolbottom{ position: absolute; left: 0; top: 45px; width: 1920px; height: 1px; background: var(--cx-tool-edge); }
.toolgap   { position: absolute; left: 0; top: 46px; width: 1920px; height: 3px; background: var(--cx-gap); }

/* ---------- menu bar labels ---------- */
.menubar .m {
  position: absolute; top: 0; height: 18px;
  display: flex; align-items: center;
  padding: 0 8px;
  font-family: var(--cx-font-ui);
  font-size: 12px; color: #000;
  white-space: nowrap; cursor: default;
  line-height: 18px;
}
/* the real menubar baseline sits 2px lower than a flex-centred line box */
.menubar .m .lbl { position: relative; top: 2px; }
.menubar .m:hover, .menubar .m.open { background: #E5F1FB; }

/* ---------- toolbar ---------- */
.tb-btn {
  position: absolute; top: 4px;
  width: 16px; height: 16px;
  cursor: default;
}
.tb-btn img { width: 16px; height: 16px; }
.tb-btn:hover { outline: 1px solid #B8D6EE; outline-offset: 1px; background: var(--cx-hover); }
.tb-sep {
  position: absolute; top: -1px; height: 25px; width: 2px;
  background: linear-gradient(to right, #B9B9B9 0px, #B9B9B9 1px, #FFFFFF 1px, #FFFFFF 2px);
}
/* Qt draws the group separators as a 3px-wide diagonal dotted strip (4px period) */
.tb-dots {
  position: absolute; top: 2px; height: 19px; width: 3px;
  background-image: url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIzIiBoZWlnaHQ9IjQiIHNoYXBlLXJlbmRlcmluZz0iY3Jpc3BFZGdlcyI+PHJlY3QgeD0iMCIgeT0iMCIgd2lkdGg9IjIiIGhlaWdodD0iMSIgZmlsbD0iI0ZBRkFGQSIvPjxyZWN0IHg9IjAiIHk9IjEiIHdpZHRoPSIxIiBoZWlnaHQ9IjEiIGZpbGw9IiNGQUZBRkEiLz48cmVjdCB4PSIxIiB5PSIxIiB3aWR0aD0iMSIgaGVpZ2h0PSIxIiBmaWxsPSIjRTFFMUUxIi8+PHJlY3QgeD0iMiIgeT0iMSIgd2lkdGg9IjEiIGhlaWdodD0iMSIgZmlsbD0iI0I4QjhCOCIvPjxyZWN0IHg9IjEiIHk9IjIiIHdpZHRoPSIyIiBoZWlnaHQ9IjEiIGZpbGw9IiNCOEI4QjgiLz48L3N2Zz4=");
  background-repeat: repeat;
  background-size: 3px 4px;
}

/* Qt toolbar-internal separator: 1px #D3D3D3 line the height of the icon row */
.tb-thin {
  position: absolute; top: 4px; height: 16px; width: 1px;
  background: #D3D3D3;
}

/* ---------- canvas (pure CSS, flat #808080 as measured) ---------- */
.canvas {
  position: absolute; left: 3px; top: 49px;
  width: 1914px; height: 940px;
  border: 1px solid #000000;
  background: var(--cx-canvas);
}

/* ---------- status bar ---------- */
.statusbar {
  position: absolute; left: 0; top: 989px; width: 1920px; height: 21px;
  background: linear-gradient(to bottom,
      #F0F0F0 0px, #F0F0F0 18px,
      #EFEFEF 18px, #EEEEEE 19px,
      #F5F5F5 20px, #F5F5F5 21px);
}
.statusbar .msg {
  position: absolute; left: 8px; top: 5px;
  font-family: var(--cx-font-ui);
  font-size: 11px; line-height: 13px; color: #000;
  white-space: nowrap;
}

/* ---------- Qt-style popup menus (shared .qtmenu overridden to CFX-Pre look) ---------- */
.qtmenu {
  background: #F0F0F0;
  border: 1px solid var(--cx-menu-border);
  box-shadow: 2px 2px 3px rgba(0, 0, 0, .18);
  padding: 2px 0;
  min-width: 200px;
  font-size: 12px;
  font-family: var(--cx-font-ui);
  color: #000;
}
.qtmenu .mi {
  height: 22px; padding: 0 26px 0 28px;
  display: flex; align-items: center;
  font-size: 12px; color: #000;
  white-space: nowrap; position: relative;
}
.qtmenu .mi:hover { background: var(--cx-menu-hover); }
.qtmenu .mi.disabled { color: #9A9A9A; }
.qtmenu .mi .icon {
  position: absolute; left: 6px; top: 3px;
  width: 16px; height: 16px; object-fit: contain;
}
.qtmenu .mi .accel {
  margin-left: auto; padding-left: 28px;
  font-size: 11px; color: #5A5A5A;
}
.qtmenu .mi.disabled .accel { color: #B4B4B4; }
.qtmenu .mi .arrow { margin-left: auto; padding-left: 24px; color: #444; font-size: 13px; }
.qtmenu .sep { height: 1px; background: #D7D7D7; margin: 3px 2px; }

/* ---------- about dialog (Qt look, used by Help > About CFX-Pre) ---------- */
.cxp-dialog { position: fixed; z-index: 9600; background: #F0F0F0; border: 1px solid #9AA4AE;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .22); font-size: 12px; }
.cxp-dialog .tbar { height: 26px; display: flex; align-items: center; padding: 0 8px;
  background: #F0F0F0; border-bottom: 1px solid #D7DBDF; font-weight: 600; }
.cxp-dialog .tbar .x { margin-left: auto; width: 22px; height: 18px; display: grid; place-items: center; }
.cxp-dialog .tbar .x:hover { background: #E5E5E5; }
.cxp-dialog .body { padding: 14px 16px; }
.cxp-dialog .body .appname { font-weight: 700; font-size: 13px; margin-bottom: 6px; }
.cxp-dialog .body .row { margin: 2px 0; }
.cxp-dialog .foot { display: flex; justify-content: flex-end; padding: 8px 12px; border-top: 1px solid #E1E5E9; }
.cxp-dialog button { font-family: var(--font-ui); font-size: 12px; height: 22px; min-width: 62px;
  background: #E9EBEE; border: 1px solid #AEB4BA; border-radius: 2px; color: #1F1F1F; }
.cxp-dialog button:hover { background: #DDEBF7; border-color: #7EB4EA; }
.modal-backdrop { position: fixed; inset: 0; background: transparent; z-index: 9500; }
/* the shared modal backdrop must not swallow menubar hover/click (Qt switches menus on hover) */
.modal-backdrop.menu { top: 19px; }