/* 3DHM CAD-style shell — Hot Stamp apps (Toolpath View, Die Check) and the Nesting tool.
   Two icon bars on top (file & output / work tools), left and right panels always visible (width can be dragged),
   status line at the bottom. Theme: follows Windows (light / dark) or a fixed choice; icon size big / small.
   Everything is scoped to the element with class "hs-root": <html class="hs-root"> for a whole-page app,
   or a <div class="hs-root"> inside a normal website page. hsui.js sets data-theme / data-icons on it. */

.hs-root {
  --hs-bg: #e6e9ee; --hs-bar: #f6f7f9; --hs-bar2: #eef1f4; --hs-panel: #ffffff; --hs-sunk: #f2f4f7; --hs-field: #ffffff;
  --hs-line: #d2d7df; --hs-line-soft: #e3e7ec; --hs-fg: #1b2029; --hs-muted: #5d6676;
  --hs-hover: #e3e8ef; --hs-press: #d7e3f6; --hs-press-line: #8fb0e3;
  --hs-accent: #1f5fc4; --hs-accent-fg: #ffffff; --hs-go: #1e7a4d; --hs-go-h: #19673f;
  --hs-ok: #17804d; --hs-warn: #a86000; --hs-err: #c0331e; --hs-stage: #dde1e7;
  --hs-tip-bg: #1f252e; --hs-tip-fg: #eef2f7; --hs-tip-muted: #aeb8c8;
  --hs-shadow: 0 6px 24px rgb(15 20 30 / .18);
  --hs-ui: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --hs-mono: ui-monospace, "Cascadia Mono", "SFMono-Regular", Menlo, Consolas, monospace;
  --hs-ic: 32px; --hs-lbw: 64px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) { .hs-root:not([data-theme="light"]) {
  --hs-bg: #12161c; --hs-bar: #1d232b; --hs-bar2: #191e25; --hs-panel: #1a1f27; --hs-sunk: #151a20; --hs-field: #11151b;
  --hs-line: #303946; --hs-line-soft: #262e39; --hs-fg: #dde4ee; --hs-muted: #8f9bb0;
  --hs-hover: #29313c; --hs-press: #263b5a; --hs-press-line: #4f7fc4;
  --hs-accent: #5a9bff; --hs-accent-fg: #0d1420; --hs-go: #2f7a55; --hs-go-h: #378d63;
  --hs-ok: #5fcf96; --hs-warn: #f2a33a; --hs-err: #ff7a66; --hs-stage: #2b3442;
  --hs-tip-bg: #f3f5f8; --hs-tip-fg: #161b22; --hs-tip-muted: #566070;
  --hs-shadow: 0 8px 28px rgb(0 0 0 / .5);
  color-scheme: dark; } }
.hs-root[data-theme="dark"] {
  --hs-bg: #12161c; --hs-bar: #1d232b; --hs-bar2: #191e25; --hs-panel: #1a1f27; --hs-sunk: #151a20; --hs-field: #11151b;
  --hs-line: #303946; --hs-line-soft: #262e39; --hs-fg: #dde4ee; --hs-muted: #8f9bb0;
  --hs-hover: #29313c; --hs-press: #263b5a; --hs-press-line: #4f7fc4;
  --hs-accent: #5a9bff; --hs-accent-fg: #0d1420; --hs-go: #2f7a55; --hs-go-h: #378d63;
  --hs-ok: #5fcf96; --hs-warn: #f2a33a; --hs-err: #ff7a66; --hs-stage: #2b3442;
  --hs-tip-bg: #f3f5f8; --hs-tip-fg: #161b22; --hs-tip-muted: #566070;
  --hs-shadow: 0 8px 28px rgb(0 0 0 / .5);
  color-scheme: dark; }
.hs-root[data-icons="small"] { --hs-ic: 20px; }

html.hs-root, html.hs-root body { height: 100%; margin: 0; }
html.hs-root body { background: var(--hs-bg); color: var(--hs-fg); font-family: var(--hs-ui); }
div.hs-root { color: var(--hs-fg); font-family: var(--hs-ui); }

/* ---------- layout ---------- */
.hs-app { height: 100%; display: grid; box-sizing: border-box;
  grid-template-columns: var(--hs-lw, 260px) 5px minmax(0, 1fr) 5px var(--hs-rw, 310px);
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  grid-template-areas: "b1 b1 b1 b1 b1" "b2 b2 b2 b2 b2" "left g1 main g2 right" "st st st st st"; }
.hs-app *, .hs-app *::before, .hs-app *::after { box-sizing: border-box; }
.hs-bar { display: flex; align-items: stretch; flex-wrap: wrap; gap: 2px; padding: 4px 6px; min-width: 0; }
.hs-bar.b1 { grid-area: b1; background: var(--hs-bar); border-bottom: 1px solid var(--hs-line-soft); }
.hs-bar.b2 { grid-area: b2; background: var(--hs-bar2); border-bottom: 1px solid var(--hs-line); }
.hs-side { min-width: 0; min-height: 0; overflow: auto; background: var(--hs-panel); padding: 12px 12px 32px;
  display: flex; flex-direction: column; gap: 16px; scrollbar-width: thin; }
.hs-side > * { flex-shrink: 0; }
.hs-side.left { grid-area: left; }
.hs-side.right { grid-area: right; }
.hs-main { grid-area: main; min-width: 0; min-height: 0; position: relative; display: flex; flex-direction: column; }
.hs-grip { background: var(--hs-panel); cursor: col-resize; position: relative; touch-action: none; }
.hs-grip.g1 { grid-area: g1; } .hs-grip.g2 { grid-area: g2; }
.hs-grip::after { content: ""; position: absolute; top: 0; bottom: 0; left: 2px; width: 1px; background: var(--hs-line); }
.hs-grip:hover::after, .hs-grip.on::after { left: 1px; width: 3px; background: var(--hs-accent); }
.hs-status { grid-area: st; display: flex; align-items: center; gap: 18px; min-height: 26px; padding: 2px 12px;
  background: var(--hs-bar); border-top: 1px solid var(--hs-line); font: 11.5px var(--hs-mono); color: var(--hs-muted);
  font-variant-numeric: tabular-nums; overflow: hidden; white-space: nowrap; }
.hs-status b { color: var(--hs-fg); font-weight: 600; }
.hs-resizing, .hs-resizing * { cursor: col-resize !important; user-select: none !important; }

/* panel sections */
.hs-sec { display: flex; flex-direction: column; gap: 7px; }
.hs-sec > h2, .hs-h { margin: 0; padding-bottom: 5px; border-bottom: 1px solid var(--hs-line-soft); font-size: 11px; font-weight: 700;
  letter-spacing: .06em; text-transform: uppercase; color: var(--hs-muted); display: flex; gap: 6px; align-items: baseline; }
.hs-brand { display: flex; gap: 9px; align-items: center; }
.hs-brand b { font-size: 14px; font-weight: 650; display: block; }
.hs-brand small { color: var(--hs-muted); font-size: 11.5px; line-height: 1.4; display: block; }
.hs-file { font: 12px var(--hs-mono); padding: 7px 9px; border: 1px solid var(--hs-line); border-radius: 5px; background: var(--hs-sunk);
  overflow-wrap: anywhere; display: flex; gap: 8px; align-items: flex-start; }
.hs-file svg { flex: none; width: 16px; height: 16px; color: var(--hs-muted); margin-top: 1px; }

/* ---------- toolbar buttons ---------- */
.hs-grp { display: flex; align-items: stretch; gap: 1px; }
.hs-sep { width: 1px; margin: 4px 5px; background: var(--hs-line); flex: none; }
.hs-sp { flex: 1 1 8px; }
.tb { position: relative; display: inline-flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  min-width: var(--hs-lbw); padding: 4px 5px 3px; border: 1px solid transparent; border-radius: 6px; background: transparent;
  color: var(--hs-fg); font: 500 11px/1.15 var(--hs-ui); cursor: pointer; text-decoration: none; user-select: none; -webkit-user-select: none; }
.tb .ic { width: var(--hs-ic); height: var(--hs-ic); flex: none; display: block; }
.tb .lb { max-width: 86px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--hs-fg); }
.tb input { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }
.tb:hover { background: var(--hs-hover); }
.tb:active { background: var(--hs-press); }
.tb[aria-pressed="true"], .tb[aria-selected="true"], .tb:has(input:checked), .tb.on {
  background: var(--hs-press); border-color: var(--hs-press-line); }
.tb:disabled, .tb[aria-disabled="true"] { opacity: .38; cursor: default; pointer-events: none; }
.tb:focus-visible, .tb:has(input:focus-visible) { outline: 2px solid var(--hs-accent); outline-offset: 0; }
.tb.go { background: var(--hs-go); color: #fff; border-color: transparent; }
.tb.go .lb { color: #fff; font-weight: 600; }
.tb.go:hover { background: var(--hs-go-h); }
.tb.go.blue { background: var(--hs-accent); }
.tb.go.blue .lb, .tb.go.blue { color: var(--hs-accent-fg); }
.tb.go.blue:hover { filter: brightness(1.08); }
.tb.go.stale { box-shadow: 0 0 0 3px color-mix(in srgb, var(--hs-ok) 45%, transparent); }
.tb.go.blue.stale { box-shadow: 0 0 0 3px color-mix(in srgb, var(--hs-accent) 45%, transparent); }
.tb.danger .ic { color: var(--hs-err); }
.tb.warnc .ic, .tb.warnc .lb { color: var(--hs-warn); }
.tb.okc .ic, .tb.okc .lb { color: var(--hs-ok); }
.tb.errc .ic, .tb.errc .lb { color: var(--hs-err); }
.tb.report .ic { color: var(--hs-err); }
.tb .badge { position: absolute; top: 3px; right: 6px; }
.hs-root[data-icons="small"] .tb { min-width: 0; padding: 4px; }
.hs-root[data-icons="small"] .tb .lb { display: none; }
.hs-root[data-icons="small"] .hs-bar { padding: 3px 6px; }

/* compact field (select / number) inside a bar */
.tf { display: inline-flex; flex-direction: column; justify-content: center; gap: 3px; padding: 2px 6px; font: 500 11px var(--hs-ui); color: var(--hs-muted); }
.tf .row { display: flex; align-items: center; gap: 4px; }
.tf select, .tf input { font: 12.5px var(--hs-ui); color: var(--hs-fg); background: var(--hs-field); border: 1px solid var(--hs-line);
  border-radius: 4px; padding: 3px 5px; height: 26px; }
.tf input[type=number] { width: 70px; font-family: var(--hs-mono); }
.hs-root[data-icons="small"] .tf { flex-direction: row; align-items: center; gap: 5px; }

/* app switcher menu */
.hs-menu { position: fixed; z-index: 90; min-width: 220px; background: var(--hs-panel); color: var(--hs-fg); border: 1px solid var(--hs-line);
  border-radius: 8px; box-shadow: var(--hs-shadow); padding: 5px; display: flex; flex-direction: column; gap: 1px; }
.hs-menu button { display: flex; gap: 9px; align-items: center; padding: 8px 10px; border: 0; border-radius: 5px; background: none;
  color: inherit; font: 13px var(--hs-ui); text-align: left; cursor: pointer; }
.hs-menu button:hover, .hs-menu button:focus-visible { background: var(--hs-hover); outline: none; }
.hs-menu button[aria-current="true"] { font-weight: 650; }
.hs-menu button[aria-current="true"]::after { content: "✓"; margin-left: auto; color: var(--hs-accent); }
.hs-menu .ico { width: 20px; height: 20px; flex: none; display: grid; place-items: center; }
.hs-menu .ico svg { width: 20px; height: 20px; }

/* hover card */
.hs-tip { position: fixed; z-index: 100; max-width: 300px; padding: 8px 10px; border-radius: 6px; background: var(--hs-tip-bg); color: var(--hs-tip-fg);
  box-shadow: var(--hs-shadow); font: 12.5px/1.4 var(--hs-ui); pointer-events: none; opacity: 0; transform: translateY(-2px);
  transition: opacity .12s, transform .12s; }
.hs-tip.show { opacity: 1; transform: none; }
.hs-tip .t { display: flex; gap: 8px; align-items: baseline; font-weight: 650; }
.hs-tip kbd { margin-left: auto; font: 600 11px var(--hs-mono); padding: 1px 6px; border-radius: 4px; border: 1px solid var(--hs-tip-muted); color: var(--hs-tip-muted); }
.hs-tip .d { margin-top: 3px; color: var(--hs-tip-muted); }
.hs-tip .s { margin-top: 4px; font-weight: 600; }
.hs-tip .w { margin-top: 5px; padding-top: 5px; border-top: 1px solid color-mix(in srgb, var(--hs-tip-muted) 40%, transparent); color: #e09a2a; font-weight: 600; }
.hs-root[data-theme="dark"] .hs-tip .w { color: #a35b00; }

/* an app inside a website page: fixed height; "full screen" fills the window */
div.hs-root > .hs-app { height: clamp(560px, 86vh, 1100px); border: 1px solid var(--hs-line); border-radius: 10px; overflow: hidden; }
/* inside a page the app is narrower: slightly tighter buttons so the bars stay on one row */
div.hs-root { --hs-lbw: 46px; }
div.hs-root .tb { padding: 4px 3px 3px; }
div.hs-root .tb .lb { font-size: 10.5px; max-width: 74px; }
div.hs-root.hs-max { --hs-lbw: 64px; }
div.hs-root.hs-max { position: fixed; inset: 0; z-index: 2147483000; background: var(--hs-bg); }
div.hs-root.hs-max > .hs-app { height: 100vh; height: 100dvh; border: 0; border-radius: 0; }
html.hs-lock, html.hs-lock body { overflow: hidden !important; }
/* phone tabs for the side panels (shown only on small screens) */
.hs-mtabs { display: none; }

/* small screens: everything under each other */
@media (max-width: 900px) {
  .hs-app { height: auto; min-height: 100%; grid-template-columns: minmax(0, 1fr); grid-template-rows: auto;
    grid-template-areas: "b1" "b2" "main" "left" "right" "st"; }
  .hs-grip { display: none; }
  .hs-main { height: 72vh; min-height: 420px; }
  .hs-side { overflow: visible; border-top: 1px solid var(--hs-line); }
  div.hs-root > .hs-app { height: auto; }
  div.hs-root.hs-max > .hs-app { height: 100dvh; overflow: auto; }
  /* bars scroll sideways instead of growing */
  .hs-bar { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: thin; }
  .hs-bar > * { flex-shrink: 0; }
  /* side panels as tabs under the drawing */
  .hs-app.hs-has-mtabs { grid-template-areas: "b1" "b2" "main" "mt" "left" "right" "st"; }
  .hs-mtabs { grid-area: mt; display: flex; gap: 2px; padding: 4px 6px; background: var(--hs-bar2); border-top: 1px solid var(--hs-line); }
  .hs-mtabs button { flex: 1; padding: 8px 6px; border: 1px solid transparent; border-radius: 6px; background: none; color: var(--hs-fg); font: 600 13px var(--hs-ui); }
  .hs-mtabs button[aria-selected="true"] { background: var(--hs-press); border-color: var(--hs-press-line); }
  .hs-app.hs-has-mtabs .hs-side[data-mhidden="1"], .hs-app.hs-has-mtabs .hs-side > [data-mhidden="1"] { display: none; }
}
@media (prefers-reduced-motion: reduce) { .hs-tip { transition: none; } }
