/* ai-cam.css: styles for ai-cam.html (AI CAM workspace, v2 interface).
   The app has its own neutral grey theme (dark by default, light on request) set with data-bs-theme on #aicam,
   so Bootstrap form controls inside follow it. One accent colour: the site's teal. */

.aicam {
    --ac-bg: #2b2d31; --ac-bg2: #232528; --ac-view: #1f2023; --ac-raise: #34373c; --ac-hover: #3b3e44; --ac-field: #1d1e21;
    --ac-line: #3f4248; --ac-text: #e4e6ea; --ac-muted: #a9aeb6; --ac-accent: #1f8a99; --ac-accent-strong: #17707d;
    --ac-accent-text: #62c9d7; --ac-sel: rgba(31, 138, 153, .30); --ac-ok: #3fb950; --ac-warn: #e3b341; --ac-err: #f47067;
    --ac-stale: #93a6ba; --ac-shadow: 0 8px 28px rgba(0, 0, 0, .45); --ac-focus: #62c9d7;
    --bs-body-bg: var(--ac-bg); --bs-body-color: var(--ac-text); --bs-secondary-color: var(--ac-muted);
    --bs-tertiary-bg: var(--ac-bg2); --bs-border-color: var(--ac-line); --bs-emphasis-color: #fff; --bs-link-color-rgb: 98, 201, 215;
    --bs-primary: #1f8a99; --bs-primary-rgb: 31, 138, 153;
    position: relative; display: flex; flex-direction: column; overflow: hidden;
    height: calc(100vh - 130px); min-height: 600px; max-height: 1150px;
    background: var(--ac-bg); color: var(--ac-text); font-size: 13px; line-height: 1.4;
    border: 1px solid var(--ac-line); border-radius: 8px;
}
.aicam[data-bs-theme=light] {
    --ac-bg: #f1f2f4; --ac-bg2: #e6e8eb; --ac-view: #fbfbfc; --ac-raise: #ffffff; --ac-hover: #dfe2e6; --ac-field: #ffffff;
    --ac-line: #c9ced5; --ac-text: #1c1f24; --ac-muted: #525963; --ac-accent: #1f8a99; --ac-accent-strong: #17707d;
    --ac-accent-text: #12636f; --ac-sel: rgba(31, 138, 153, .17); --ac-ok: #1a7f37; --ac-warn: #8a5a00; --ac-err: #c4202b;
    --ac-stale: #56606b; --ac-shadow: 0 8px 26px rgba(20, 30, 40, .18); --ac-focus: #17707d;
    --bs-emphasis-color: #000; --bs-link-color-rgb: 18, 99, 111;
}
.aicam *:focus-visible { outline: 2px solid var(--ac-focus); outline-offset: 1px; }
.aicam .form-control, .aicam .form-select { background-color: var(--ac-field); color: var(--ac-text); border-color: var(--ac-line); font-size: 12.5px; }
.aicam .form-control:focus, .aicam .form-select:focus { border-color: var(--ac-accent); box-shadow: 0 0 0 .18rem rgba(31, 138, 153, .35); }
.aicam .form-check-input { background-color: var(--ac-field); border-color: var(--ac-muted); }
.aicam .form-check-input:checked { background-color: var(--ac-accent-strong); border-color: var(--ac-accent-strong); }
.aicam kbd { background: var(--ac-raise); color: var(--ac-text); border: 1px solid var(--ac-line); font-size: 11px; padding: 1px 5px; }
.aicam a { color: var(--ac-accent-text); }
.aicam-phone-note { display: none; }

/* ---------- small building blocks ---------- */
.ac-ib, .ac-tb, .ac-btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 5px; border: 1px solid transparent; background: transparent;
    color: var(--ac-text); border-radius: 5px; font-size: 12.5px; line-height: 1.2; cursor: pointer; white-space: nowrap;
}
.ac-ib { width: 28px; height: 28px; padding: 0; }
.ac-tb { height: 30px; padding: 0 8px; }
.ac-btn { height: 28px; padding: 0 10px; border-color: var(--ac-line); background: var(--ac-raise); }
.ac-ib:hover:not(:disabled), .ac-tb:hover:not(:disabled), .ac-btn:hover:not(:disabled) { background: var(--ac-hover); }
.ac-ib:disabled, .ac-tb:disabled, .ac-btn:disabled, .ac-rbtn:disabled { opacity: .45; cursor: default; }
.ac-btn-primary { background: var(--ac-accent-strong); border-color: var(--ac-accent-strong); color: #fff; font-weight: 600; }
.ac-btn-primary:hover:not(:disabled) { background: #13606b; }
.ac-btn-go { background: #2b7a3d; border-color: #2b7a3d; color: #fff; font-weight: 600; }
.ac-btn-go:hover:not(:disabled) { background: #236632; }
.ac-btn-danger { color: var(--ac-err); }
.ac-tb[aria-pressed=true], .ac-tb[aria-expanded=true] { background: var(--ac-sel); }
.ac-caret { font-size: 9px; opacity: .8; }
.ac-sep { width: 1px; height: 20px; background: var(--ac-line); margin: 0 4px; flex: 0 0 auto; }
.ac-spacer { flex: 1 1 auto; }
.ac-narrow-only { display: none; }
.ac-chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px; border-radius: 99px; background: var(--ac-raise); border: 1px solid var(--ac-line); font-size: 12px; color: var(--ac-text); }
.ac-chip-sm { padding: 1px 7px; font-size: 11px; margin-left: 6px; }
.ac-chip[hidden] { display: none; }
.ac-chip .spinner-border-sm { width: .8rem; height: .8rem; border-width: .14em; }

/* ---------- app bar ---------- */
.ac-appbar { display: flex; align-items: center; gap: 2px; padding: 4px 8px; background: var(--ac-bg2); border-bottom: 1px solid var(--ac-line); flex: 0 0 auto; min-width: 0; }
.ac-brand { font-weight: 700; font-size: 13.5px; letter-spacing: .02em; padding: 0 6px 0 2px; white-space: nowrap; }
.ac-beta { font-size: 9.5px; font-weight: 700; text-transform: uppercase; background: #f0b429; color: #1c1f24; border-radius: 99px; padding: 1px 6px; vertical-align: 2px; }
.ac-projname { border: 1px solid var(--ac-line); background: var(--ac-field); color: var(--ac-text); border-radius: 5px; height: 26px; padding: 0 8px; max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12.5px; }
.ac-projname:hover { background: var(--ac-hover); }

/* ---------- ribbon ---------- */
.ac-ribbon { background: var(--ac-bg); border-bottom: 1px solid var(--ac-line); flex: 0 0 auto; min-width: 0; }
.ac-rtabs { display: flex; gap: 2px; padding: 3px 8px 0; overflow-x: auto; scrollbar-width: none; border-bottom: 1px solid var(--ac-line); background: var(--ac-bg2); }
.ac-rtab { border: 0; background: transparent; color: var(--ac-muted); font-size: 11.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; padding: 5px 10px 6px; border-bottom: 2px solid transparent; white-space: nowrap; cursor: pointer; }
.ac-rtab:hover { color: var(--ac-text); }
.ac-rtab[aria-selected=true] { color: var(--ac-text); border-bottom-color: var(--ac-accent); background: var(--ac-bg); border-radius: 4px 4px 0 0; }
.ac-rbody { display: flex; align-items: stretch; min-width: 0; }
.ac-rpanels { flex: 1 1 auto; min-width: 0; overflow-x: auto; scrollbar-width: thin; }
.ac-rpanel { display: flex; align-items: stretch; gap: 0; padding: 4px 6px; }
.ac-rpanel[hidden] { display: none; }
.ac-rgroup { display: flex; gap: 2px; padding: 0 6px; border-right: 1px solid var(--ac-line); flex: 0 0 auto; }
.ac-rgroup:last-child { border-right: 0; }
.ac-rfixed { border-left: 1px solid var(--ac-line); border-right: 0; padding: 4px 8px; }
.ac-rbtn {
    display: flex; flex-direction: column; align-items: center; justify-content: flex-start; gap: 2px; min-width: 58px; max-width: 92px;
    padding: 4px 6px 3px; border: 1px solid transparent; border-radius: 5px; background: transparent; color: var(--ac-text); cursor: pointer;
    font-size: 11.5px; line-height: 1.15; text-align: center;
}
.ac-rbtn > i { font-size: 21px; line-height: 1; color: var(--ac-accent-text); }
.ac-rbtn:hover:not(:disabled) { background: var(--ac-hover); }
.ac-rbtn[aria-pressed=true], .ac-rbtn[aria-expanded=true] { background: var(--ac-sel); border-color: var(--ac-accent); }

/* ---------- main area ---------- */
.ac-main { flex: 1 1 auto; display: flex; min-height: 0; position: relative; }
.ac-browser { width: 256px; flex: 0 0 256px; border-right: 1px solid var(--ac-line); }
.ac-props { width: 340px; flex: 0 0 340px; border-left: 1px solid var(--ac-line); }
.ac-drawer { display: flex; flex-direction: column; min-height: 0; background: var(--ac-bg); min-width: 0; }
.ac-phead { display: flex; align-items: center; gap: 6px; padding: 6px 10px; border-bottom: 1px solid var(--ac-line); background: var(--ac-bg2); font-weight: 700; font-size: 12px; text-transform: uppercase; letter-spacing: .05em; min-height: 34px; }
.ac-ptitle { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ac-phead .ac-close { margin-left: auto; }
.ac-pbody { flex: 1 1 auto; overflow-y: auto; padding: 0 0 16px; min-height: 0; }
.ac-backdrop { display: none; }

/* checklist */
.ac-checklist { list-style: none; display: flex; flex-wrap: wrap; gap: 3px 4px; padding: 7px 8px; margin: 0; border-bottom: 1px solid var(--ac-line); }
.ac-checklist li { font-size: 11px; padding: 1px 7px 1px 5px; border-radius: 99px; border: 1px solid var(--ac-line); color: var(--ac-muted); display: inline-flex; align-items: center; gap: 3px; }
.ac-checklist li.done { color: var(--ac-text); border-color: var(--ac-ok); }
.ac-checklist li.done i { color: var(--ac-ok); }
.ac-checklist li.now { border-color: var(--ac-accent); color: var(--ac-text); }

/* tree */
.ac-tree { flex: 1 1 auto; overflow-y: auto; padding: 4px 0 12px; min-height: 0; }
.ac-folder { margin: 0; padding: 0; list-style: none; }
.ac-fhead { display: flex; align-items: center; gap: 4px; width: 100%; border: 0; background: transparent; color: var(--ac-muted); font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; padding: 6px 8px 3px; cursor: pointer; text-align: left; }
.ac-fhead:hover { color: var(--ac-text); }
.ac-fhead .bi-chevron-down { transition: transform .15s; font-size: 10px; }
.ac-fhead[aria-expanded=false] .bi-chevron-down { transform: rotate(-90deg); }
.ac-fhead .ac-fcount { margin-left: auto; font-weight: 600; }
.ac-fadd { margin-left: 4px; }
.ac-nodes { list-style: none; margin: 0; padding: 0; }
.ac-node { display: flex; align-items: center; gap: 2px; padding: 0 4px 0 14px; min-height: 28px; position: relative; border-left: 2px solid transparent; }
.ac-node:hover { background: var(--ac-hover); }
.ac-node.is-sel { background: var(--ac-sel); border-left-color: var(--ac-accent); }
.ac-node.is-off .ac-nmain { opacity: .55; }
.ac-node.drop-before { box-shadow: inset 0 2px 0 var(--ac-accent); }
.ac-node.drop-after { box-shadow: inset 0 -2px 0 var(--ac-accent); }
.ac-node .form-check-input { margin: 0 3px 0 0; flex: 0 0 auto; width: 14px; height: 14px; }
.ac-nmain { flex: 1 1 auto; min-width: 0; display: flex; align-items: center; gap: 6px; border: 0; background: transparent; color: var(--ac-text); padding: 4px 2px; text-align: left; cursor: pointer; font-size: 12.5px; }
.ac-nmain .ac-nt { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ac-nmain .ac-nm { display: block; font-size: 11px; color: var(--ac-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ac-nmain .ac-ntext { min-width: 0; flex: 1 1 auto; }
.ac-nnum { font-variant-numeric: tabular-nums; color: var(--ac-muted); font-size: 11px; min-width: 14px; text-align: right; }
.ac-node .ac-ib { width: 24px; height: 24px; color: var(--ac-muted); }
.ac-node .ac-ib:hover { color: var(--ac-text); }
.ac-node .ac-kebab { opacity: 0; }
.ac-node:hover .ac-kebab, .ac-node.is-sel .ac-kebab, .ac-node .ac-kebab:focus-visible { opacity: 1; }
.ac-st { font-size: 13px; flex: 0 0 auto; }
.ac-st.none { color: var(--ac-muted); } .ac-st.ok { color: var(--ac-ok); } .ac-st.warn { color: var(--ac-warn); } .ac-st.stale { color: var(--ac-stale); } .ac-st.error { color: var(--ac-err); }
.ac-st.busy { color: var(--ac-accent-text); animation: acSpin 1.2s linear infinite; display: inline-block; }
@keyframes acSpin { to { transform: rotate(360deg); } }
.ac-empty-line { font-size: 11.5px; color: var(--ac-muted); padding: 2px 10px 4px 22px; }
.ac-ticon { color: var(--ac-accent-text); flex: 0 0 auto; }

/* ---------- viewport ---------- */
.ac-view { position: relative; flex: 1 1 auto; min-width: 0; min-height: 0; background: var(--ac-view); overflow: hidden; }
.aicam-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; outline: none; }
.aicam-canvas:focus-visible { box-shadow: inset 0 0 0 2px var(--ac-focus); }
#view2d { cursor: crosshair; touch-action: none; }
#view2d.is-panning { cursor: grabbing; }
#view2d.is-picking, #view3d.is-picking canvas { cursor: pointer; }
.ac-view.is-over { outline: 3px dashed var(--ac-accent); outline-offset: -6px; }
.ac-ov { position: absolute; z-index: 3; display: flex; gap: 6px; flex-wrap: wrap; }
.ac-ov-tl { left: 8px; top: 8px; max-width: calc(100% - 300px); }
.ac-ov-tr { right: 8px; top: 8px; }
.ac-seg { display: inline-flex; background: color-mix(in srgb, var(--ac-bg) 92%, transparent); border: 1px solid var(--ac-line); border-radius: 6px; overflow: hidden; box-shadow: 0 1px 4px rgba(0, 0, 0, .2); }
.ac-seg button { border: 0; background: transparent; color: var(--ac-text); font-size: 11.5px; min-width: 28px; height: 26px; padding: 0 7px; cursor: pointer; border-right: 1px solid var(--ac-line); }
.ac-seg button:last-child { border-right: 0; }
.ac-seg button:hover:not(:disabled) { background: var(--ac-hover); }
.ac-seg button[aria-pressed=true] { background: var(--ac-accent-strong); color: #fff; }
.ac-seg button:disabled { opacity: .4; }
.ac-pickbar { position: absolute; z-index: 4; left: 50%; top: 44px; transform: translateX(-50%); display: flex; align-items: center; gap: 8px; padding: 6px 8px 6px 12px; border-radius: 8px; background: var(--ac-raise); border: 1px solid var(--ac-accent); box-shadow: var(--ac-shadow); max-width: calc(100% - 20px); }
.ac-pickbar[hidden] { display: none; }
.ac-pickbar span { font-size: 12.5px; }
#updChip { position: absolute; z-index: 4; left: 50%; bottom: 10px; transform: translateX(-50%); box-shadow: var(--ac-shadow); }
.ac-empty { position: absolute; inset: 0; z-index: 2; display: flex; align-items: center; justify-content: center; padding: 60px 16px 16px; pointer-events: none; }
.ac-empty[hidden] { display: none; }
.ac-empty-card { pointer-events: auto; background: var(--ac-raise); border: 1px solid var(--ac-line); border-radius: 10px; padding: 18px 20px; max-width: 430px; box-shadow: var(--ac-shadow); }
.ac-empty-title { font-size: 15px; font-weight: 700; margin-bottom: 4px; }
.ac-empty-card p { color: var(--ac-muted); margin-bottom: 10px; }
.ac-empty-btns { display: flex; flex-wrap: wrap; gap: 6px; }
.ac-empty-note { font-size: 11.5px; color: var(--ac-muted); margin-top: 10px; }
.aicam-legend[hidden] { display: none !important; }
.aicam-legend {
    position: absolute; right: 8px; bottom: 8px; z-index: 2; font-size: 11px; line-height: 1.4; max-width: 15rem; pointer-events: none;
    background: color-mix(in srgb, var(--ac-bg) 88%, transparent); border: 1px solid var(--ac-line); border-radius: 6px; padding: 4px 8px; color: var(--ac-text);
}
.aicam-legend:empty { display: none; }
.aicam-legend .sw { display: inline-block; width: 1.4em; height: 0; border-top: 2px solid; vertical-align: middle; margin-right: .3em; }
.aicam-legend .sw.dash { border-top-style: dashed; }
.aicam-legend .bx { display: inline-block; width: .8em; height: .8em; vertical-align: middle; margin-right: .3em; border-radius: 2px; }
.aicam-legend .text-muted { color: var(--ac-muted) !important; }
.aicam-hint { position: absolute; left: 8px; bottom: 28px; z-index: 2; font-size: 11.5px; max-width: calc(100% - 270px); background: color-mix(in srgb, var(--ac-bg) 90%, transparent); border: 1px solid var(--ac-line); border-radius: 6px; padding: 3px 8px; pointer-events: none; }
.aicam-hint:empty { display: none; }
.aicam-coords { position: absolute; left: 8px; bottom: 8px; z-index: 2; font: 11px/1.2 ui-monospace, SFMono-Regular, Consolas, monospace; color: var(--ac-muted); pointer-events: none; }

/* ---------- properties ---------- */
.ac-sec { border-bottom: 1px solid var(--ac-line); }
.ac-sec > summary { list-style: none; display: flex; align-items: center; gap: 6px; padding: 7px 12px; font-weight: 700; font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--ac-muted); cursor: pointer; user-select: none; }
.ac-sec > summary::-webkit-details-marker { display: none; }
.ac-sec > summary::before { content: '\F282'; font-family: bootstrap-icons; font-size: 10px; transition: transform .15s; }
.ac-sec:not([open]) > summary::before { transform: rotate(-90deg); }
.ac-sec > summary:hover { color: var(--ac-text); }
.ac-sec > summary .ac-sec-info { margin-left: auto; text-transform: none; letter-spacing: 0; font-weight: 600; color: var(--ac-text); }
.ac-secbody { padding: 2px 12px 12px; }
.ac-ptop { padding: 10px 12px 8px; border-bottom: 1px solid var(--ac-line); }
.ac-ptop-row { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.ac-ptype { display: flex; align-items: center; gap: 6px; font-weight: 700; font-size: 13.5px; margin-bottom: 4px; }
.ac-ptype i { color: var(--ac-accent-text); font-size: 16px; }
.ac-pnote { font-size: 12px; color: var(--ac-muted); margin: 2px 0 8px; }
.ac-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 10px; }
.ac-grid .full { grid-column: 1 / -1; }
.ac-field { min-width: 0; }
.ac-field[hidden] { display: none; }
.ac-flabel { display: flex; align-items: center; gap: 4px; font-size: 11.5px; color: var(--ac-muted); margin-bottom: 2px; user-select: none; }
.ac-flabel.is-scrub { cursor: ew-resize; }
.ac-flabel.is-scrub:hover { color: var(--ac-text); }
.ac-flabel .bi-info-circle { font-size: 10.5px; opacity: .8; }
.ac-fin { position: relative; display: flex; }
.ac-fin .form-control { padding: 3px 34px 3px 7px; height: 28px; }
.ac-unit { position: absolute; right: 7px; top: 50%; transform: translateY(-50%); font-size: 11px; color: var(--ac-muted); pointer-events: none; }
.ac-field .form-select { height: 28px; padding-top: 2px; padding-bottom: 2px; }
.ac-field .form-check { font-size: 12.5px; margin: 4px 0 0; min-height: 0; }
.ac-help { font-size: 11.5px; color: var(--ac-muted); margin-top: 2px; display: none; }
.ac-field:focus-within .ac-help { display: block; }
.ac-field.is-bad .form-control { border-color: var(--ac-err); }
.ac-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.ac-box { border: 1px solid var(--ac-line); border-radius: 6px; padding: 8px 10px; margin: 8px 0; background: var(--ac-bg2); font-size: 12px; }
.ac-box.ok { border-color: var(--ac-ok); }
.ac-box.warn { border-color: var(--ac-warn); }
.ac-box.err { border-color: var(--ac-err); }
.ac-box ul { margin: 4px 0 0; padding-left: 18px; }
.ac-box .ac-bt { font-weight: 700; display: flex; gap: 6px; align-items: center; }
.ac-box.ok .ac-bt i { color: var(--ac-ok); } .ac-box.warn .ac-bt i { color: var(--ac-warn); } .ac-box.err .ac-bt i { color: var(--ac-err); }
.ac-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; margin: 8px 0; }
.ac-stats div { background: var(--ac-bg2); border: 1px solid var(--ac-line); border-radius: 5px; padding: 3px 7px; font-size: 11px; color: var(--ac-muted); }
.ac-stats b { display: block; font-size: 12.5px; color: var(--ac-text); }
.ac-picks { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.ac-picks .ac-btn { height: 24px; font-size: 11.5px; padding: 0 8px; }
.ac-selcount { font-weight: 700; }
.ac-drop { border: 2px dashed var(--ac-line); border-radius: 8px; padding: 14px; text-align: center; color: var(--ac-muted); cursor: pointer; }
.ac-drop:hover, .ac-drop.is-over { border-color: var(--ac-accent); color: var(--ac-text); }
.ac-drop i { font-size: 22px; display: block; color: var(--ac-accent-text); }
.ac-toollist { list-style: none; margin: 0; padding: 0; }
.ac-toollist li { display: flex; align-items: center; gap: 4px; border-bottom: 1px solid var(--ac-line); }
.ac-toollist li.is-sel { background: var(--ac-sel); }
.ac-toollist .ac-nmain { padding: 5px 4px; }
.aicam-code { font: 11.5px/1.35 ui-monospace, SFMono-Regular, Consolas, monospace; height: 220px; white-space: pre; resize: vertical; }
.ac-files { list-style: none; margin: 6px 0; padding: 0; }
.ac-files li { display: flex; align-items: center; gap: 6px; border: 1px solid var(--ac-line); border-radius: 5px; margin-bottom: 4px; padding: 0 6px 0 0; }
.ac-files li.is-sel { border-color: var(--ac-accent); background: var(--ac-sel); }
.ac-badge { font-size: 10.5px; font-weight: 700; padding: 1px 6px; border-radius: 99px; border: 1px solid currentColor; white-space: nowrap; }
.ac-badge.ok { color: var(--ac-ok); } .ac-badge.warn { color: var(--ac-warn); } .ac-badge.err { color: var(--ac-err); }
.ac-details { font-size: 12px; margin: 6px 0; }
.ac-details summary { cursor: pointer; color: var(--ac-accent-text); }
.ac-feedsum { font-size: 11.5px; color: var(--ac-muted); margin-top: 3px; }
.ac-diagram { width: 100%; height: auto; display: block; margin: 4px 0 8px; background: var(--ac-view); border: 1px solid var(--ac-line); border-radius: 6px; }
.ac-diagram .stk { fill: color-mix(in srgb, #c9a06a 16%, transparent); stroke: #a8865a; stroke-width: 1; }
.ac-diagram .ax { stroke: var(--ac-muted); fill: none; stroke-width: 1.2; }
.ac-diagram .feat { fill: color-mix(in srgb, var(--ac-accent) 22%, transparent); stroke: var(--ac-text); stroke-width: 1.4; }
.ac-diagram .feat.out { fill: none; stroke-dasharray: 0; }
.ac-diagram .slot { stroke: color-mix(in srgb, var(--ac-accent) 45%, transparent); stroke-width: 16; stroke-linecap: round; }
.ac-diagram .hole { fill: color-mix(in srgb, var(--ac-accent) 25%, transparent); stroke: var(--ac-text); stroke-width: 1.2; }
.ac-diagram .pcd { fill: none; stroke: var(--ac-muted); stroke-dasharray: 4 3; }
.ac-diagram .tab { fill: var(--ac-warn); }
.ac-diagram .pth { stroke: var(--ac-accent); stroke-width: 1.4; fill: none; }
.ac-diagram .cut { fill: var(--ac-view); stroke: var(--ac-text); stroke-width: 1; }
.ac-diagram .z0 { stroke: var(--ac-err); stroke-width: 1.2; stroke-dasharray: 5 3; }
.ac-diagram .ln { stroke: var(--ac-muted); stroke-width: 1; stroke-dasharray: 3 3; fill: none; }
.ac-diagram .cm { stroke: var(--ac-text); stroke-width: 1.2; fill: var(--ac-text); }
.ac-diagram .dm { stroke: var(--ac-muted); stroke-width: 1; }
.ac-diagram .arr { fill: var(--ac-muted); }
.ac-diagram .dl { font: 10px system-ui, sans-serif; fill: var(--ac-muted); }
.ac-diagram .on { stroke: #f08c00 !important; }
.ac-diagram .dm.on, .ac-diagram .ln.on { stroke-width: 2; stroke-dasharray: none; }
.ac-diagram .feat.on, .ac-diagram .hole.on, .ac-diagram .cut.on { stroke-width: 2.4; }
.ac-diagram text.on { fill: #f08c00; font-weight: 700; stroke: none !important; }
.ac-diagram .slot.on { stroke: color-mix(in srgb, #f08c00 55%, transparent) !important; }

/* ---------- timeline and status bar ---------- */
.ac-timeline { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; padding: 5px 10px; border-top: 1px solid var(--ac-line); background: var(--ac-bg2); flex: 0 0 auto; }
.ac-tl-ctrls { display: flex; align-items: center; gap: 1px; }
.ac-speed { width: auto; height: 26px; padding-top: 0; padding-bottom: 0; margin-left: 4px; }
.ac-scrubwrap { position: relative; flex: 1 1 220px; min-width: 140px; height: 26px; display: flex; align-items: center; }
.ac-segs { position: absolute; left: 0; right: 0; top: 50%; height: 8px; transform: translateY(-50%); display: flex; border-radius: 4px; overflow: hidden; background: var(--ac-line); }
.ac-segs span { height: 100%; border-right: 1px solid var(--ac-bg2); }
.ac-scrub { position: relative; width: 100%; margin: 0; background: transparent; -webkit-appearance: none; appearance: none; height: 26px; cursor: pointer; }
.ac-scrub:disabled { cursor: default; }
.ac-scrub::-webkit-slider-runnable-track { height: 8px; background: transparent; }
.ac-scrub::-webkit-slider-thumb { -webkit-appearance: none; width: 6px; height: 22px; margin-top: -7px; border-radius: 2px; background: var(--ac-text); border: 1px solid var(--ac-bg); }
.ac-scrub::-moz-range-track { height: 8px; background: transparent; }
.ac-scrub::-moz-range-thumb { width: 5px; height: 20px; border-radius: 2px; background: var(--ac-text); border: 1px solid var(--ac-bg); }
.ac-scrub:disabled::-webkit-slider-thumb { background: var(--ac-muted); }
.ac-simtime { font: 12px ui-monospace, SFMono-Regular, Consolas, monospace; color: var(--ac-muted); white-space: nowrap; }
.ac-siminfo { flex: 1 1 100%; font-size: 12px; color: var(--ac-muted); min-height: 1.2em; }
.ac-siminfo .t-err { color: var(--ac-err); font-weight: 600; } .ac-siminfo .t-ok { color: var(--ac-ok); } .ac-siminfo .t-warn { color: var(--ac-warn); }
.ac-siminfo b { color: var(--ac-text); }
.ac-statusbar { display: flex; align-items: center; gap: 12px; padding: 3px 10px; min-height: 26px; border-top: 1px solid var(--ac-line); background: var(--ac-bg); font-size: 12px; flex: 0 0 auto; min-width: 0; }
.ac-next { color: var(--ac-accent-text); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 0 1 auto; min-width: 0; }
.ac-msg { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ac-msg .t-err { color: var(--ac-err); } .ac-msg .t-warn { color: var(--ac-warn); } .ac-msg .t-ok { color: var(--ac-ok); } .ac-msg .t-info { color: var(--ac-accent-text); }
.ac-sb-right { display: flex; gap: 12px; align-items: center; color: var(--ac-muted); white-space: nowrap; flex: 0 0 auto; }
.aicam-busy { white-space: nowrap; }
.aicam-busy.is-busy { color: var(--ac-accent-text); font-weight: 600; }
.aicam-busy .spinner-border-sm { width: .8rem; height: .8rem; border-width: .14em; }

/* ---------- menus, dialogs, tour ---------- */
.ac-menu { position: fixed; z-index: 1100; min-width: 190px; padding: 4px; background: var(--ac-raise); border: 1px solid var(--ac-line); border-radius: 7px; box-shadow: var(--ac-shadow); }
.ac-menu[hidden] { display: none; }
.ac-menu button { display: flex; align-items: center; gap: 8px; width: 100%; border: 0; background: transparent; color: var(--ac-text); padding: 6px 10px; border-radius: 4px; font-size: 12.5px; text-align: left; cursor: pointer; }
.ac-menu button:hover, .ac-menu button:focus-visible { background: var(--ac-hover); outline: none; }
.ac-menu button:disabled { opacity: .45; cursor: default; }
.ac-menu button.danger { color: var(--ac-err); }
.ac-menu kbd { margin-left: auto; }
.ac-menu hr { margin: 3px 4px; border-color: var(--ac-line); opacity: 1; }
.ac-dialog { position: absolute; z-index: 1090; right: 12px; top: 44px; width: min(420px, calc(100% - 24px)); max-height: calc(100% - 60px); overflow-y: auto; padding: 12px 16px; background: var(--ac-raise); border: 1px solid var(--ac-line); border-radius: 10px; box-shadow: var(--ac-shadow); font-size: 13px; }
.ac-dialog[hidden] { display: none; }
#keysDlg { left: 50%; right: auto; transform: translateX(-50%); }
.ac-dlg-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.ac-dlg-title { font-size: 15px; font-weight: 700; margin: 0; flex: 1 1 auto; }
.ac-dlg-title i { color: var(--ac-accent-text); }
.ac-dlg-note { font-size: 12px; color: var(--ac-muted); margin: 6px 0 0; }
.ac-keys { width: 100%; font-size: 12.5px; }
.ac-keys td { padding: 3px 4px; border-bottom: 1px solid var(--ac-line); }
.ac-keys td:first-child { white-space: nowrap; width: 40%; }
.ac-tour { position: fixed; z-index: 1095; width: min(320px, calc(100vw - 24px)); padding: 12px 14px; background: var(--ac-raise); border: 1px solid var(--ac-accent); border-radius: 10px; box-shadow: var(--ac-shadow); font-size: 13px; }
.ac-tour[hidden], .ac-tour-ring[hidden] { display: none; }
.ac-tour h2 { font-size: 14.5px; font-weight: 700; margin: 2px 0 4px; }
.ac-tour p { margin: 0 0 10px; color: var(--ac-muted); }
.ac-tour .ac-tstep { font-size: 11px; color: var(--ac-muted); }
.ac-tour .ac-tbtns { display: flex; gap: 6px; align-items: center; }
.ac-tour-ring { position: fixed; z-index: 1094; border: 2px solid var(--ac-accent); border-radius: 8px; box-shadow: 0 0 0 4px rgba(31, 138, 153, .3); pointer-events: none; transition: all .2s; }

/* ---------- focus mode ---------- */
html.aicam-focus, html.aicam-focus body { overflow: hidden !important; }
html.aicam-focus .aicam { position: fixed; inset: 0; z-index: 1045; height: auto; min-height: 0; max-height: none; margin: 0 !important; border: 0; border-radius: 0; }
html.aicam-focus #sidebar-container, html.aicam-focus .top-navbar, html.aicam-focus .dashboard-content > :not(#aicam), html.aicam-focus .mc-footer, html.aicam-focus footer { display: none !important; }
html.aicam-focus .dashboard-content { padding: 0; }

/* ---------- narrow screens: drawers ---------- */
@media (max-width: 899.98px) {
    .aicam-phone-note { display: block; }
    .aicam { height: calc(100svh - 70px); min-height: 540px; max-height: none; }
    .ac-narrow-only { display: inline-flex; }
    .ac-sep, .ac-lbl { display: none; }
    .ac-appbar { overflow-x: auto; scrollbar-width: none; gap: 0; padding: 3px 4px; }
    .ac-tb { padding: 0 7px; }
    .ac-projname { max-width: 110px; }
    .ac-drawer { position: absolute; top: 0; bottom: 0; z-index: 30; width: min(330px, 88%); transition: transform .2s ease, visibility .2s; visibility: hidden; box-shadow: var(--ac-shadow); }
    .ac-browser { left: 0; flex: none; transform: translateX(-102%); }
    .ac-props { right: 0; flex: none; transform: translateX(102%); }
    .ac-drawer.is-open { transform: none; visibility: visible; }
    .ac-backdrop { display: block; position: absolute; inset: 0; z-index: 25; background: rgba(0, 0, 0, .45); }
    .ac-backdrop[hidden] { display: none; }
    .ac-rpanel { padding: 2px 2px; }
    .ac-rgroup { padding: 0 3px; }
    .ac-rbtn { min-width: 52px; font-size: 10.5px; padding: 3px 4px; }
    .ac-rbtn > i { font-size: 18px; }
    .ac-rfixed { padding: 2px 4px; }
    .ac-ov-tl { max-width: calc(100% - 16px); }
    .ac-ov-tr { top: auto; bottom: 8px; right: 8px; }
    #dispBar { display: none; }
    .aicam-legend { display: none; }
    .aicam-hint { bottom: 44px; max-width: calc(100% - 16px); }
    .ac-pickbar { top: 42px; flex-wrap: wrap; justify-content: center; }
    .ac-statusbar .ac-sb-right #sbUnits, .ac-statusbar .ac-sb-right #sbSel { display: none; }
    .ac-next { max-width: 55%; }
    .ac-scrubwrap { flex-basis: 100%; order: 5; }
    .ac-timeline { gap: 4px 6px; }
}
@media (max-width: 420px) {
    .ac-grid { grid-template-columns: 1fr; }
    .ac-timeline .ac-simtime { display: none; }
    #btnSim { padding: 0 8px; }
}
@media (prefers-reduced-motion: reduce) {
    .ac-drawer, .ac-tour-ring, .ac-fhead .bi-chevron-down { transition: none; }
    .ac-st.busy { animation: none; }
}

/* ======================= desktop-application chrome ======================= */
/* This page: the app fills the window on load; the site's top bar, H1 and intro fold into the app chrome. */
html.aicam-page .dashboard-content { padding: 0; }
html.aicam-page .dashboard-content > :not(#aicam) { margin-left: 24px; margin-right: 24px; }
/* The site's top bar (menu button, search) and sidebar stay as on every other page (2026-11-19); the app fills the rest
   of the window under the top bar. --mc-topbar is measured by the page script, 58px until then. */
html.aicam-page .aicam { height: calc(100vh - var(--mc-topbar, 58px)); height: calc(100dvh - var(--mc-topbar, 58px)); min-height: 520px; max-height: none; border: 0; border-radius: 0; margin-bottom: 0 !important; }
@media (max-width: 899.98px) {
    html.aicam-page .dashboard-content > :not(#aicam) { margin-left: 14px; margin-right: 14px; }
}
.aicam-about { font-size: .95rem; }
.aicam-about .breadcrumb { margin-bottom: .5rem; }

/* title bar */
.ac-appbar { min-height: 32px; padding: 2px 6px; background: linear-gradient(var(--ac-bg2), color-mix(in srgb, var(--ac-bg2) 85%, #000)); }
.aicam[data-bs-theme=light] .ac-appbar { background: linear-gradient(#eceef1, #e1e4e8); }
.ac-h1 { font-size: 12.5px; font-weight: 700; margin: 0 6px 0 4px; white-space: nowrap; line-height: 1; letter-spacing: .01em; }
.ac-h1-sub { font-weight: 400; color: var(--ac-muted); }
@media (max-width: 1280px) { .ac-h1-sub { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; } }
button.ac-beta { border: 0; cursor: pointer; margin-right: 6px; line-height: 1.4; }
.ac-tb { height: 26px; padding: 0 7px; font-size: 12px; }
.ac-projname { height: 22px; font-size: 12px; }

/* menu bar */
.ac-menubar { display: flex; align-items: center; gap: 0; padding: 0 4px; height: 24px; background: var(--ac-bg); border-bottom: 1px solid var(--ac-line); flex: 0 0 auto; overflow-x: auto; scrollbar-width: none; }
.ac-mbtn { border: 0; background: transparent; color: var(--ac-text); font-size: 12.5px; padding: 0 9px; height: 22px; border-radius: 3px; cursor: default; white-space: nowrap; }
.ac-mbtn:hover { background: var(--ac-hover); }
.ac-mbtn[aria-expanded=true] { background: var(--ac-sel); }
.ac-menu { border-radius: 3px; padding: 3px; min-width: 230px; max-height: calc(100vh - 16px); overflow-y: auto; }
.ac-menu button { padding: 4px 10px 4px 6px; font-size: 12.5px; border-radius: 2px; min-height: 24px; }
.ac-menu button:hover, .ac-menu button:focus-visible { background: var(--ac-accent-strong); color: #fff; }
.ac-menu button:hover kbd, .ac-menu button:focus-visible kbd { color: #fff; }
.ac-menu kbd { background: transparent; border: 0; color: var(--ac-muted); font-family: inherit; font-size: 11.5px; padding: 0 0 0 16px; }
.ac-menu .bi-blank { display: inline-block; width: 1em; }

/* ribbon: flatter */
.ac-rtabs { padding: 2px 6px 0; }
.ac-rtab { font-size: 11px; padding: 3px 10px 4px; }
.ac-rpanel { padding: 3px 4px; }
.ac-rbtn { border-radius: 3px; min-width: 54px; font-size: 11px; padding: 3px 5px 2px; }
.ac-rbtn > i { font-size: 19px; }

/* docked, resizable panels */
.aicam { --ac-bw: 256px; --ac-pw: 340px; }
.ac-browser { width: var(--ac-bw); flex: 0 0 var(--ac-bw); border-right: 0; }
.ac-props { width: var(--ac-pw); flex: 0 0 var(--ac-pw); border-left: 0; }
.aicam.browser-off .ac-browser, .aicam.props-off .ac-props { display: none; }
.ac-split { flex: 0 0 5px; width: 5px; cursor: col-resize; background: var(--ac-bg2); border-left: 1px solid var(--ac-line); border-right: 1px solid var(--ac-line); position: relative; z-index: 5; touch-action: none; }
.ac-split:hover, .ac-split.is-drag, .ac-split:focus-visible { background: var(--ac-accent); outline: none; }
.ac-phead { min-height: 26px; padding: 3px 8px; font-size: 11px; }
.ac-ptabs { padding: 0 4px; gap: 0; align-items: stretch; }
.ac-ptab { border: 0; background: transparent; color: var(--ac-muted); font-size: 11.5px; font-weight: 600; padding: 4px 9px; border-bottom: 2px solid transparent; text-transform: none; letter-spacing: 0; cursor: pointer; white-space: nowrap; }
.ac-ptab[aria-selected=true] { color: var(--ac-text); border-bottom-color: var(--ac-accent); background: var(--ac-bg); }
.ac-psub { display: flex; align-items: center; gap: 6px; padding: 4px 10px; border-bottom: 1px solid var(--ac-line); font-weight: 600; font-size: 12px; min-height: 26px; min-width: 0; }
.ac-psub i { color: var(--ac-accent-text); }
.ac-ptop { padding: 8px 10px 6px; }
.ac-ptype { font-size: 12.5px; margin-bottom: 2px; }
.ac-sec > summary { padding: 4px 10px; font-size: 11px; background: var(--ac-bg2); border-top: 1px solid var(--ac-line); }
.ac-sec { border-bottom: 0; }
.ac-secbody { padding: 6px 10px 8px; }
.ac-node { min-height: 24px; }
.ac-nmain { padding: 2px 2px; font-size: 12px; }
.ac-box { border-radius: 2px; }
.ac-btn { border-radius: 3px; height: 24px; font-size: 12px; }
.ac-stats div { border-radius: 2px; font-variant-numeric: tabular-nums; }
.ac-stats b, .ac-simtime, .aicam-coords, .ac-nnum { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; }
.ac-fin .form-control { height: 24px; font-variant-numeric: tabular-nums; border-radius: 2px; }
.ac-field .form-select { height: 24px; border-radius: 2px; font-size: 12px; }
.ac-flabel { font-size: 11px; margin-bottom: 1px; }
.ac-grid { gap: 5px 8px; }
.ac-seg, .ac-pickbar, .ac-empty-card, .aicam-legend, .aicam-hint, .ac-chip { border-radius: 3px; }
.ac-timeline { padding: 3px 8px; }
.ac-statusbar { min-height: 22px; padding: 2px 8px; font-size: 11.5px; background: var(--ac-bg2); }
.aicam.is-busy .ac-view, .aicam.is-busy .ac-view canvas { cursor: progress; }

/* drop overlay */
.ac-dropov { position: absolute; inset: 0; z-index: 8; display: none; align-items: center; justify-content: center; background: color-mix(in srgb, var(--ac-accent) 18%, transparent); border: 2px dashed var(--ac-accent); pointer-events: none; }
.ac-dropov div { background: var(--ac-raise); border: 1px solid var(--ac-accent); padding: 10px 16px; font-weight: 600; display: flex; gap: 8px; align-items: center; }
.ac-dropov i { font-size: 20px; color: var(--ac-accent-text); }
.ac-view.is-over .ac-dropov { display: flex; }
.ac-view.is-over { outline: 0; }

/* small modal windows */
.ac-winback { position: absolute; inset: 0; z-index: 1098; background: rgba(0, 0, 0, .35); }
.ac-win { position: absolute; z-index: 1099; left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(480px, calc(100% - 24px)); max-height: calc(100% - 40px); display: flex; flex-direction: column; background: var(--ac-bg); border: 1px solid var(--ac-line); box-shadow: var(--ac-shadow); border-radius: 4px; overflow: hidden; }
.ac-wintitle { display: flex; align-items: center; gap: 7px; padding: 3px 4px 3px 10px; background: linear-gradient(var(--ac-raise), var(--ac-bg2)); border-bottom: 1px solid var(--ac-line); font-weight: 600; font-size: 12.5px; min-height: 30px; }
.ac-wintitle i { color: var(--ac-accent-text); }
.ac-wintitle .ac-winx { margin-left: auto; }
.ac-winbody { padding: 10px 12px; overflow-y: auto; }
.ac-winfoot { display: flex; justify-content: flex-end; gap: 6px; padding: 7px 10px; border-top: 1px solid var(--ac-line); background: var(--ac-bg2); }
.ac-winfoot .ac-btn { min-width: 72px; }
.ac-dialog { border-radius: 4px; padding: 0 12px 10px; }
.ac-dialog .ac-dlg-head { margin: 0 -12px 8px; padding: 4px 4px 4px 10px; background: linear-gradient(var(--ac-raise), var(--ac-bg2)); border-bottom: 1px solid var(--ac-line); }
.ac-dialog .ac-dlg-title { font-size: 12.5px; }
.ac-tour { border-radius: 4px; }
@media (max-width: 899.98px) {
    .ac-split { display: none; }
    .ac-browser { width: min(330px, 88%); flex: none; }
    .ac-props { width: min(360px, 92%); flex: none; }
    .aicam.browser-off .ac-browser, .aicam.props-off .ac-props { display: flex; }
    .ac-menubar { height: 26px; }
    .ac-h1 { font-size: 12px; }
}

/* ---------- sketch mode (ai-cam-sketch.js) ---------- */
.ac-skbar { position: absolute; z-index: 4; left: 50%; top: 40px; transform: translateX(-50%); display: flex; align-items: center; gap: 6px; padding: 4px 6px 4px 10px; width: max-content; max-width: calc(100% - 16px); background: var(--ac-raise); border: 1px solid var(--ac-accent); border-radius: 3px; box-shadow: var(--ac-shadow); }
.ac-skbar[hidden] { display: none; }
/* a narrow view (small laptop, side panels open): the command bar wraps, the prompt gets its own line */
.ac-view { container: acview / inline-size; }
@container acview (max-width: 560px) {
    .ac-skbar { top: 38px; flex-wrap: wrap; justify-content: center; padding: 4px 6px; width: calc(100% - 16px); }
    .ac-skbar > i { display: none; }
    .ac-skprompt { flex: 1 1 100%; max-width: none; font-size: 11.5px; }
    .ac-skbar .form-control { width: 110px; }
}
@container acview (max-width: 400px) { .ac-skbar .ac-lbl { display: none; } }
.ac-skbar > i { color: var(--ac-accent-text); flex: 0 0 auto; }
.ac-skprompt { font-size: 12px; min-width: min(220px, 100%); max-width: 520px; flex: 0 1 auto; line-height: 1.25; }
.ac-skbar { flex-wrap: wrap; row-gap: 4px; }   /* not enough room: the buttons go to a second row (the prompt is never squeezed to a word a line) */
.ac-skbar .form-control { width: 150px; flex: 0 0 auto; height: 24px; padding: 1px 6px; border-radius: 2px; font: 12px ui-monospace, SFMono-Regular, Consolas, monospace; }
.ac-skbar .form-control:disabled { opacity: .5; }
.ac-skbar .ac-btn { flex: 0 0 auto; }
.ac-view.is-sketching #view2d { cursor: crosshair; }
.ac-view.is-sketching .ac-viewcube [data-view="front"], .ac-view.is-sketching .ac-viewcube [data-view="right"], .ac-view.is-sketching .ac-viewcube [data-view="iso"] { opacity: .5; }
.ac-skprob { list-style: none; padding-left: 0 !important; }
.ac-skprob li { margin: 2px 0; }
.ac-linkbtn { border: 0; background: transparent; color: var(--ac-text); padding: 0; text-align: left; font-size: 12px; cursor: pointer; text-decoration: underline dotted; text-underline-offset: 2px; }
.ac-linkbtn:hover { color: var(--ac-accent-text); }
@media (max-width: 899.98px) {
    .ac-skbar { top: 38px; flex-wrap: wrap; justify-content: center; padding: 4px 6px; }
    .ac-skbar > i { display: none; }
    .ac-skprompt { flex: 1 1 100%; max-width: none; font-size: 11.5px; }
    .ac-skbar .form-control { width: 120px; }
}

/* ---------- imported G-code: program tab, editor, checks, Upgrade (ai-cam-gcode-editor.js) ---------- */
.ac-pbody.is-editor { display: flex; flex-direction: column; overflow: hidden; padding: 0; }
.ac-gtabs { padding: 6px 8px 0; flex: 0 0 auto; }
.ac-gtabs .ac-seg { box-shadow: none; }
.ac-pbody:not(.is-editor) > .ac-gtabs { padding-bottom: 2px; }
.ac-gchead { padding: 6px 8px; flex: 0 0 auto; display: flex; flex-direction: column; gap: 6px; border-bottom: 1px solid var(--ac-line); min-width: 0; }
.ac-gcrow { display: flex; align-items: center; gap: 4px; min-width: 0; flex-wrap: wrap; }
.ac-gcrow .form-select { flex: 1 1 auto; min-width: 0; }
.ac-gcname { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.ac-gcname i { color: var(--ac-accent-text); }
.ac-gcbtns .ac-btn { padding: 0 8px; }
.ac-gcinfo { display: flex; flex-wrap: wrap; gap: 2px 10px; font-size: 11px; color: var(--ac-muted); font-variant-numeric: tabular-nums; }
.ac-gced { flex: 1 1 auto; min-height: 170px; position: relative; }
.ac-gcmove { flex: 0 0 auto; font-size: 11.5px; padding: 4px 8px; border-top: 1px solid var(--ac-line); color: var(--ac-muted); min-height: 24px; line-height: 1.35; }
.ac-gcdiag { flex: 0 0 auto; max-height: 34%; overflow: auto; border-top: 1px solid var(--ac-line); padding: 4px 8px 6px; font-size: 12px; }
.ac-gcdiag summary { cursor: pointer; font-weight: 600; }
.ac-gcdiag summary .ac-badge { margin-left: 6px; }
.ac-gcread { margin: 6px 0; }
.ac-gclist { list-style: none; margin: 4px 0; padding: 0; }
.ac-gcl { display: block; width: 100%; text-align: left; border: 0; background: transparent; color: var(--ac-text); font-size: 12px; line-height: 1.35; padding: 3px 4px; border-radius: 2px; cursor: pointer; }
.ac-gcl:hover { background: var(--ac-hover); }
.ac-gcl i { margin-right: 4px; }
.lv-error .ac-gcl i { color: var(--ac-err); } .lv-warn .ac-gcl i { color: var(--ac-warn); } .lv-info .ac-gcl i { color: var(--ac-accent-text); }
.ac-gcln { font: 11px ui-monospace, SFMono-Regular, Consolas, monospace; color: var(--ac-muted); margin-right: 3px; }
.ac-gcsrc { font-size: 10.5px; color: var(--ac-muted); margin-left: 4px; white-space: nowrap; }
/* the editor */
.gce { position: absolute; inset: 0; display: flex; flex-direction: column; background: var(--ac-field); }
.gce-body { position: relative; flex: 1 1 auto; display: flex; min-height: 0; }
.gce-gut { flex: 0 0 auto; position: relative; overflow: hidden; background: var(--ac-bg2); border-right: 1px solid var(--ac-line); cursor: pointer; user-select: none; }
.gce-gin { position: absolute; left: 0; right: 0; top: 0; }
.gce-n { height: 18px; padding-right: 6px; text-align: right; font: 11px/18px ui-monospace, SFMono-Regular, Consolas, monospace; color: var(--ac-muted); }
.gce-main { position: relative; flex: 1 1 auto; min-width: 0; overflow: hidden; }
.gce-hl { position: absolute; left: 0; top: 0; min-width: 100%; pointer-events: none; }
.gce-l, .gce-ta, .gce-measure { font: 12px/18px ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace; letter-spacing: 0; tab-size: 4; font-variant-ligatures: none; }
.gce-l { height: 18px; white-space: pre; color: var(--ac-text); margin-left: -6px; padding-left: 6px; }
.gce-ta { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; border: 0; outline: none; resize: none; padding: 3px 6px; background: transparent; color: transparent; caret-color: var(--ac-text); white-space: pre; overflow: auto; }
.gce-ta::selection { background: rgba(98, 201, 215, .32); color: transparent; }
.gce-ta:focus-visible { outline: none; box-shadow: inset 0 0 0 1px var(--ac-focus); }
.gce-measure { position: absolute; visibility: hidden; white-space: pre; left: 0; top: 0; }
.gce-l.gce-err { background: rgba(244, 112, 103, .15); }
.gce-l.gce-warn { background: rgba(227, 179, 65, .11); }
.gce-l.gce-mark { background: rgba(255, 212, 59, .20); box-shadow: inset 3px 0 0 #ffd43b; }
.gce-n.gce-err { color: var(--ac-err); font-weight: 700; } .gce-n.gce-warn { color: var(--ac-warn); }
.gce-n.gce-mark { color: var(--ac-text); background: rgba(255, 212, 59, .28); font-weight: 700; }
.gce-hit { position: absolute; background: rgba(255, 146, 43, .45); outline: 1px solid #ff922b; border-radius: 1px; pointer-events: none; }
.gce-find { display: flex; align-items: center; gap: 3px; padding: 3px 4px 3px 6px; background: var(--ac-bg2); border-bottom: 1px solid var(--ac-line); flex: 0 0 auto; }
.gce-find[hidden] { display: none; }
.gce-find label { flex: 1 1 auto; margin: 0; min-width: 0; }
.gce-find .gce-fin { width: 100%; height: 24px; padding: 1px 6px; border-radius: 2px; }
.gce-find.is-none .gce-fin { border-color: var(--ac-err); }
.gce-fcount { font-size: 11px; color: var(--ac-muted); min-width: 54px; text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.gce-find .ac-ib { width: 24px; height: 24px; }
/* G-code colours */
.gc-g { color: #6cb6ff; } .gc-m { color: #dcbdfb; } .gc-fs { color: #f69d50; } .gc-t { color: #57c4b8; } .gc-n { color: var(--ac-muted); }
.gc-o { color: #f47067; font-weight: 600; } .gc-c { color: #8b949e; font-style: italic; } .gc-k { color: #f47067; } .gc-w { color: #adbac7; } .gc-bd { color: #f47067; font-weight: 700; }
.aicam[data-bs-theme=light] .gc-g { color: #0550ae; } .aicam[data-bs-theme=light] .gc-m { color: #8250df; } .aicam[data-bs-theme=light] .gc-fs { color: #953800; }
.aicam[data-bs-theme=light] .gc-t { color: #0a6e61; } .aicam[data-bs-theme=light] .gc-o, .aicam[data-bs-theme=light] .gc-k, .aicam[data-bs-theme=light] .gc-bd { color: #c4202b; }
.aicam[data-bs-theme=light] .gc-c { color: #57606a; } .aicam[data-bs-theme=light] .gc-w { color: #424a53; }
.aicam[data-bs-theme=light] .gce-l.gce-mark { background: rgba(255, 196, 0, .25); box-shadow: inset 3px 0 0 #e8a400; }
.aicam[data-bs-theme=light] .gce-ta::selection { background: rgba(31, 138, 153, .25); }
/* the Upgrade window */
.ac-win.ac-win-wide { width: min(1000px, calc(100% - 24px)); }
.ac-upgtop { display: flex; flex-wrap: wrap; gap: 2px 12px; font-size: 12px; color: var(--ac-muted); }
.ac-upgtop b { color: var(--ac-text); }
.ac-upgh { font-size: 12.5px; font-weight: 700; margin: 12px 0 5px; display: flex; gap: 8px; align-items: center; }
.ac-upgfind { max-height: 170px; overflow: auto; border: 1px solid var(--ac-line); background: var(--ac-bg2); padding: 2px; }
.ac-upgsum { list-style: none; padding: 0; margin: 0 0 6px; font-size: 12px; }
.ac-upgsum li { display: flex; gap: 6px; padding: 2px 0; line-height: 1.35; }
.ac-upgsum i { flex: 0 0 auto; margin-top: 1px; }
.ac-upg .t-err { color: var(--ac-err); } .ac-upg .t-warn { color: var(--ac-warn); } .ac-upg .t-ok { color: var(--ac-ok); }
.ac-upgpanes { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 8px; }
.ac-upgpane { min-width: 0; border: 1px solid var(--ac-line); }
.ac-upgph { font-size: 11.5px; font-weight: 600; padding: 3px 6px; background: var(--ac-bg2); border-bottom: 1px solid var(--ac-line); display: flex; justify-content: space-between; gap: 6px; min-width: 0; }
.ac-upgph span { color: var(--ac-muted); font-weight: 400; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ac-upged { position: relative; height: 300px; }
@media (max-width: 899.98px) {
    .ac-upgpanes { grid-template-columns: 1fr; }
    .ac-upged { height: 220px; }
    .ac-win.ac-win-wide { width: calc(100% - 12px); }
    .ac-gced { min-height: 220px; }
}
.ac-win-wide .ac-winfoot { flex-wrap: wrap; }
.ac-upg .ac-details { margin: 6px 0 0; }

/* ---------------- AI assistant (right panel tab "AI"; tools/ai-cam-assistant.js) ---------------- */
.ac-ptab-ai i { color: var(--ac-accent-text); }
.ac-node.is-ai { box-shadow: inset 3px 0 0 var(--ac-accent-text); }
.ac-node.is-ai .ac-nt::after { content: "AI"; margin-left: 6px; font-size: 9.5px; font-weight: 700; color: var(--ac-accent-text); border: 1px solid var(--ac-accent-text); border-radius: 3px; padding: 0 3px; vertical-align: 1px; }
.ac-ai { display: flex; flex-direction: column; flex: 1 1 auto; min-height: 0; font-size: 12.5px; }
.ac-ai-model { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; padding: 6px 10px; border-bottom: 1px solid var(--ac-line); background: var(--ac-bg2); color: var(--ac-muted); font-size: 11.5px; }
.ac-ai-model > i { color: var(--ac-accent-text); }
.ac-ai-prog { flex: 1 0 100%; height: 3px; background: var(--ac-line); border-radius: 2px; overflow: hidden; }
.ac-ai-prog > div { height: 100%; width: 0; background: var(--ac-accent); transition: width .2s; }
.ac-ai-link { border: 0; background: none; padding: 0; color: var(--ac-accent-text); font: inherit; text-decoration: underline; cursor: pointer; text-align: left; }
.ac-ai-link:hover { color: var(--ac-text); }
.ac-ai-dim { color: var(--ac-muted); font-size: 11.5px; }
.ac-ai-log { flex: 1 1 auto; min-height: 120px; overflow-y: auto; padding: 8px 10px; display: flex; flex-direction: column; gap: 8px; overflow-wrap: anywhere; }
.ac-ai-msg { max-width: 100%; }
.ac-ai-who { font-size: 10.5px; font-weight: 700; color: var(--ac-muted); text-transform: uppercase; letter-spacing: .03em; margin-bottom: 2px; }
.ac-ai-who i { color: var(--ac-accent-text); }
.ac-ai-body p { margin: 0 0 6px; }
.ac-ai-body p:last-child { margin-bottom: 0; }
.ac-ai-msg.user { align-self: flex-end; max-width: 92%; }
.ac-ai-msg.user .ac-ai-who { text-align: right; }
.ac-ai-msg.user .ac-ai-body { background: var(--ac-sel); border: 1px solid var(--ac-line); border-radius: 6px; padding: 5px 8px; }
.ac-ai-plan { border: 1px solid var(--ac-accent); border-radius: 4px; background: var(--ac-bg2); padding: 7px 9px; }
.ac-ai-plan.is-cancelled { border-color: var(--ac-line); opacity: .75; }
.ac-ai-plan.is-applied { border-color: var(--ac-ok); }
.ac-ai-ph { font-weight: 700; display: flex; align-items: center; gap: 6px; margin-bottom: 4px; }
.ac-ai-ph i { color: var(--ac-accent-text); }
.ac-ai-tag { margin-left: auto; font-size: 10px; font-weight: 600; color: var(--ac-muted); border: 1px solid var(--ac-line); border-radius: 3px; padding: 0 4px; }
.ac-ai-plan ol { margin: 0 0 6px; padding-left: 20px; }
.ac-ai-plan li { margin: 2px 0; }
.ac-ai-probs, .ac-ai-notes { list-style: none; margin: 4px 0 6px; padding: 0; font-size: 11.5px; }
.ac-ai-probs li { color: var(--ac-err); margin: 2px 0; }
.ac-ai-notes li { color: var(--ac-muted); margin: 2px 0; padding-left: 12px; position: relative; }
.ac-ai-notes li::before { content: "\2022"; position: absolute; left: 2px; }
.ac-ai-btns { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.ac-ai-result p { margin: 2px 0; font-size: 12px; }
.ac-ai-result .t-err, .ac-ai-body .t-err { color: var(--ac-err); } .ac-ai-result .t-warn { color: var(--ac-warn); } .ac-ai-result .t-ok { color: var(--ac-ok); }
.ac-ai-edit { display: flex; flex-wrap: wrap; gap: 4px 10px; margin: 4px 0 2px; font-size: 11.5px; color: var(--ac-muted); }
.ac-ai-edit label { display: inline-flex; align-items: center; gap: 4px; }
.ac-ai-edit input { width: 70px; height: 22px; padding: 0 4px; font-size: 12px; }
.ac-ai-links { margin-top: 4px; display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 11.5px; }
.ac-ai-facts { margin-top: 4px; font-size: 11.5px; color: var(--ac-muted); }
.ac-ai-facts summary { cursor: pointer; }
.ac-ai-sugg { display: flex; flex-wrap: wrap; gap: 4px; padding: 6px 10px 0; border-top: 1px solid var(--ac-line); }
.ac-ai-chip { border: 1px solid var(--ac-line); background: var(--ac-raise); color: var(--ac-text); border-radius: 12px; font-size: 11px; padding: 2px 8px; cursor: pointer; text-align: left; max-width: 100%; }
.ac-ai-chip:hover { background: var(--ac-hover); }
.ac-ai-form { display: flex; gap: 6px; padding: 6px 10px; align-items: flex-end; }
.ac-ai-form textarea { flex: 1 1 auto; min-width: 0; resize: none; font-size: 12.5px; background: var(--ac-field); color: var(--ac-text); border-color: var(--ac-line); }
.ac-ai-form .ac-btn { height: 30px; flex: 0 0 auto; }
.ac-ai-note { padding: 0 10px 8px; font-size: 10.5px; color: var(--ac-muted); }
@media (max-width: 899.98px) {
    .ac-ai-log { min-height: 160px; }
    .ac-ai-chip { font-size: 11.5px; }
}

/* Setup sheet window (Post > Setup sheet): the printable sheet in a frame */
.ac-win.ac-win-sheet { width: min(1000px, calc(100% - 24px)); height: calc(100% - 40px); }
.ac-win-sheet .ac-winbody { display: flex; flex-direction: column; gap: 8px; flex: 1 1 auto; min-height: 0; }
.ac-win-sheet .ac-winfoot { flex-wrap: wrap; }
.ac-sheetframe { flex: 1 1 auto; width: 100%; min-height: 260px; border: 1px solid var(--ac-line); background: #fff; border-radius: 3px; }
@media (max-width: 600px) { .ac-win.ac-win-sheet { width: calc(100% - 12px); } }

/* ---- Model workspace (tools/ai-cam-model.js) ---- */
#mdlChip { position: absolute; z-index: 4; left: 50%; bottom: 42px; transform: translateX(-50%); box-shadow: var(--ac-shadow); }
.ac-mdlsection { left: 8px; bottom: 34px; align-items: center; padding: 4px 8px; border-radius: 6px; background: var(--ac-raise); border: 1px solid var(--ac-line); font-size: 12px; }
.ac-mdlsection[hidden] { display: none; }
.ac-mdlsection input[type=range] { width: 160px; max-width: 40vw; }
.ac-node.ac-rollback .ac-nmain { border-top: 2px solid #e8590c; color: #e8590c; }
.ac-cons-btns { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 6px; }
.ac-btn.ac-btn-sm { padding: 2px 7px; font-size: 11.5px; }
.ac-cons-list { list-style: none; margin: 6px 0 0; padding: 0; font-size: 12px; }
.ac-cons-list li { display: flex; align-items: center; justify-content: space-between; gap: 6px; padding: 2px 0; border-bottom: 1px solid var(--ac-line); }
.ac-cons-list li > span { display: inline-flex; align-items: center; gap: 4px; flex-wrap: wrap; min-width: 0; }
.ac-cons-val { width: 70px !important; display: inline-block; padding: 0 4px; height: 22px; font-size: 12px; }
.ac-dim-input { position: absolute; z-index: 6; width: 80px; height: 26px; font-size: 13px; box-shadow: var(--ac-shadow); }
.ac-dim-input[hidden] { display: none; }
.ac-kv { display: flex; justify-content: space-between; gap: 8px; font-size: 12px; padding: 1px 0; }
.ac-kv b { font-weight: 600; text-align: right; }

/* The site's "New here?" sidebar-tour card sat on top of the AI panel's typing box. AI CAM has its own first-run tour,
   so on this page the site card sits at the bottom centre, over the 3D view, clear of the sidebar and the right panel. */
.mc-tour-invite { right: auto !important; left: 50% !important; transform: translateX(-50%); bottom: 96px !important; max-width: 300px; animation: none !important; }

/* New project window (File › New): kinds of project, starter choices, the "replaced" warning */
.ac-newproj { min-width: min(30rem, 100%); }
.ac-newwarn { display: flex; align-items: center; justify-content: space-between; gap: .5rem; flex-wrap: wrap; margin-bottom: .6rem; }
.ac-newkinds { display: grid; gap: .35rem; }
.ac-newkind { display: flex; align-items: flex-start; gap: .55rem; padding: .45rem .6rem; border: 1px solid var(--ac-line); border-radius: 6px; cursor: pointer; background: var(--ac-bg2); }
.ac-newkind:hover { background: var(--ac-hover); }
.ac-newkind.is-on { border-color: var(--ac-accent); box-shadow: inset 0 0 0 1px var(--ac-accent); }
.ac-newkind input { margin-top: .25rem; }
.ac-newkind > .bi { font-size: 1.1rem; color: var(--ac-accent-text); margin-top: .05rem; }
.ac-newkind b { display: block; font-weight: 600; color: var(--ac-text); }
.ac-newkind small { display: block; color: var(--ac-muted); line-height: 1.3; }
.ac-newstarter { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem; margin-top: .6rem; }
.ac-newstarter[hidden] { display: none; }
@media (max-width: 520px) { .ac-newstarter { grid-template-columns: 1fr; } }
.ac-empty-titlerow { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.ac-empty-titlerow .ac-linkbtn { font-size: 12.5px; font-weight: 500; white-space: nowrap; }

/* Colour-coded ribbon: each tab (and the buttons on its panel) has its own colour, so the kind of tool is clear at a
   glance. Dark theme shades first, light theme shades below (icons and tab marks only; text keeps the theme colours). */
.aicam {
    --ac-cat-setup: #9fb3c8; --ac-cat-model: #62c9d7; --ac-cat-sketch: #e3b341; --ac-cat-conv: #c297f0; --ac-cat-2d: #57c785;
    --ac-cat-3d: #6cb6ff; --ac-cat-drill: #f0883e; --ac-cat-sim: #f27fb8; --ac-cat-post: #b8d867;
}
.aicam[data-bs-theme=light] {
    --ac-cat-setup: #48607a; --ac-cat-model: #12636f; --ac-cat-sketch: #8a5a00; --ac-cat-conv: #7a3fbf; --ac-cat-2d: #1a7f37;
    --ac-cat-3d: #0b5cad; --ac-cat-drill: #b34700; --ac-cat-sim: #b0306f; --ac-cat-post: #5b7a00;
}
#rt-setup, #rp-setup { --ac-cat: var(--ac-cat-setup); }
#rt-model, #rp-model { --ac-cat: var(--ac-cat-model); }
#rt-sketch, #rp-sketch { --ac-cat: var(--ac-cat-sketch); }
#rt-conv, #rp-conv { --ac-cat: var(--ac-cat-conv); }
#rt-2d, #rp-2d { --ac-cat: var(--ac-cat-2d); }
#rt-3d, #rp-3d { --ac-cat: var(--ac-cat-3d); }
#rt-drill, #rp-drill { --ac-cat: var(--ac-cat-drill); }
#rt-sim, #rp-sim { --ac-cat: var(--ac-cat-sim); }
#rt-post, #rp-post { --ac-cat: var(--ac-cat-post); }
.ac-rtab::before { content: ''; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--ac-cat, var(--ac-muted)); margin-right: 6px; vertical-align: 1px; }
.ac-rtab[aria-selected=true] { border-bottom-color: var(--ac-cat, var(--ac-accent)); }
.ac-rbtn > i { color: var(--ac-cat, var(--ac-accent-text)); }
.ac-rbtn[aria-pressed=true], .ac-rbtn[aria-expanded=true] { border-color: var(--ac-cat, var(--ac-accent)); }

/* Extrude > Profiles: the sketch's closed shapes, click to pick them (Fusion-style) */
.ac-profiles { display: block; width: 100%; height: auto; aspect-ratio: 520 / 300; border: 1px solid var(--ac-line); border-radius: 4px; cursor: pointer; margin-top: 4px; }

/* Sketch: the live dimension by the cursor (Fusion-style); typing goes to the command box it mirrors */
.ac-skfloat { position: absolute; z-index: 5; pointer-events: none; padding: 1px 6px; font: 600 12px/1.5 var(--bs-font-monospace, monospace); color: var(--ac-text); background: var(--ac-raise); border: 1px solid var(--ac-line); border-radius: 3px; box-shadow: 0 2px 6px rgba(0,0,0,.25); white-space: nowrap; }
.ac-skfloat.is-typing { border-color: var(--ac-accent); color: var(--ac-accent-text); }
.ac-gzinput { position: absolute; z-index: 6; width: 84px; height: 24px; padding: 1px 6px; font-size: 12px; }
/* the mini toolbar beside the selected sketch or body in the 3D view (next likely steps) */
.ac-empty-steps { margin: 0 0 .6rem; padding-left: 1.2rem; font-size: 13px; line-height: 1.45; }
.ac-empty-steps kbd { font-size: 11px; padding: 0 4px; }
.ac-mini { position: absolute; z-index: 5; display: flex; gap: 2px; padding: 3px; background: var(--ac-raise); border: 1px solid var(--ac-line); border-radius: 6px; box-shadow: 0 3px 10px rgba(0,0,0,.28); }
.ac-mini .ac-btn { padding: 2px 8px; font-size: 12px; white-space: nowrap; }
@media (max-width: 600px) { .ac-mini .ac-btn { padding: 4px 7px; } }

/* Model timeline (Fusion-style): features in order, the marker is the roll-back point */
.ac-ftl { position: absolute; left: 10px; top: 44px; z-index: 4; display: flex; align-items: center; gap: 0; max-width: calc(100% - 24px); overflow-x: auto; padding: 3px 6px; background: var(--ac-raise); border: 1px solid var(--ac-line); border-radius: 6px; box-shadow: var(--ac-shadow); }
.ac-ftl-chip { width: 28px; height: 26px; border: 1px solid transparent; border-radius: 4px; background: transparent; color: var(--ac-cat-model, var(--ac-accent-text)); font-size: 15px; line-height: 1; padding: 0; cursor: pointer; flex: 0 0 auto; }
.ac-ftl-chip:hover { background: var(--ac-hover); }
.ac-ftl-chip.is-sel { border-color: var(--ac-accent); background: var(--ac-sel); }
.ac-ftl-chip.is-off { opacity: .35; }
.ac-ftl-chip.is-sup { text-decoration: line-through; opacity: .5; }
.ac-ftl-chip.is-err { color: var(--ac-err); }
.ac-ftl-gap { width: 8px; height: 26px; border: 0; background: transparent; padding: 0; cursor: col-resize; flex: 0 0 auto; position: relative; }
.ac-ftl-gap:hover::after, .ac-ftl-gap.is-mark::after { content: ""; position: absolute; left: 3px; top: 2px; bottom: 2px; width: 2px; border-radius: 1px; background: var(--ac-muted); }
.ac-ftl-gap.is-mark::after { background: var(--ac-warn); width: 3px; left: 2px; }
.ac-ftl-gap.is-mark { cursor: grab; touch-action: none; }
