/* 1.43.0 (owner, 2026-10-01): BEAM looks like a CAD package - step 1, the frame. Everything here sits under body.cad
   (base.html: is_beam(current_path)), so the other tools and the admin pages keep app.css as it is.
   The frame: title bar (the top bar) · ribbon tabs (the workspace steps) · project browser (the mast list) · drawing
   area / page · status bar (_cad_status.html). Dark and light, following the theme switch; denser than app.css.
   Later steps: ribbon groups per page, properties palettes. */

/* ---- palettes: light (default) and dark ----------------------------------------------------------------------- */
body.cad {
  --cad-title: #d6dbe2; --cad-title-text: #1d2228; --cad-tabs: #e4e8ed; --cad-panel: #f4f6f8; --cad-panel-2: #e9edf1;
  --cad-line: #c3c9d1; --cad-sel: #cfe0fa; --cad-sel-text: #0f2f63; --cad-status: #d6dbe2; --cad-canvas: #ffffff;
  --bg: #e8ebef; --surface: #f7f8fa; --surface-2: #eef1f4; --border: #c9ced6; --text: #1d2228; --muted: #5d6673;
  --accent: #2f6fd0; --accent-bg: #dbe7fb; --accent-text: #ffffff; --input-bg: #ffffff; --section-bg: #e9eef6; --group-bg: #dde5f2;
  --fs-xs: 11px; --fs-sm: 12px; --fs-md: 13px; --fs-lg: 15px; --fs-xl: 17px;
  --ctl-h: 26px; --ctl-h-sm: 22px; --radius: 3px; --radius-sm: 2px; --radius-card: 3px;
  font-size: var(--fs-md); line-height: 1.4;
}
:root[data-theme="dark"] body.cad {
  --cad-title: #181b20; --cad-title-text: #d9dee6; --cad-tabs: #1c2026; --cad-panel: #2b3038; --cad-panel-2: #323843;
  --cad-line: #3d4450; --cad-sel: #2c4a73; --cad-sel-text: #ffffff; --cad-status: #181b20; --cad-canvas: #14171c;
  --bg: #1f2329; --surface: #2b3038; --surface-2: #323843; --border: #3d4450; --text: #d9dee6; --muted: #8f99a8;
  --accent: #4f8fe8; --accent-bg: #2c4a73; --accent-text: #ffffff; --input-bg: #1f2329; --section-bg: #2f3746; --group-bg: #34405a;
  --stage-bg: #14171c; --plot-bg: #14171c;
}
@media (prefers-color-scheme: dark) {
  :root[data-theme="auto"] body.cad {
    --cad-title: #181b20; --cad-title-text: #d9dee6; --cad-tabs: #1c2026; --cad-panel: #2b3038; --cad-panel-2: #323843;
    --cad-line: #3d4450; --cad-sel: #2c4a73; --cad-sel-text: #ffffff; --cad-status: #181b20; --cad-canvas: #14171c;
    --bg: #1f2329; --surface: #2b3038; --surface-2: #323843; --border: #3d4450; --text: #d9dee6; --muted: #8f99a8;
    --accent: #4f8fe8; --accent-bg: #2c4a73; --accent-text: #ffffff; --input-bg: #1f2329; --section-bg: #2f3746; --group-bg: #34405a;
    --stage-bg: #14171c; --plot-bg: #14171c;
  }
}
body.cad { background: var(--bg); color: var(--text); }
.cad-only { display: none; }
body.cad .cad-only { display: inline; }
body.cad .cad-hide { display: none; }

/* ---- title bar (the top bar) ----------------------------------------------------------------------------------- */
body.cad .topbar { min-height: 32px; height: max(32px, calc(var(--brand-logo-h, 22px) + 10px)); padding: 0 8px; gap: 10px; background: var(--cad-title); color: var(--cad-title-text);
  border-bottom: 1px solid var(--cad-line); box-shadow: none; }
body.cad .topbar .brand-logo { height: var(--brand-logo-h, 22px); }   /* 1.53.0: Admin -> appearance */
body.cad .topbar .nav { padding: 3px 8px; border-radius: var(--radius); font-size: var(--fs-sm); }
body.cad .topbar .nav:hover { background: var(--cad-panel-2); }
body.cad .topbar select, body.cad .topbar button { height: 22px; font-size: var(--fs-sm); }
body.cad .topbar .inline-label { display: none; }

/* ---- workspace bar (1.44.0, DESIGN_RULES §3b): the open document under the logo, then the Standard toolbar + the steps ---- */
body.cad .ws-bar { background: var(--cad-tabs); border-bottom: 1px solid var(--cad-line); padding: 0; }
body.cad .ws-crumbs { min-height: 26px; padding: 0 10px; gap: 8px; font-size: var(--fs-sm); flex-wrap: nowrap; white-space: nowrap;
  background: var(--cad-tabs); border-bottom: 1px solid var(--cad-line); }
body.cad .ws-crumbs .ws-doc { color: var(--text); font-weight: 600; }
body.cad .ws-crumbs .ws-lock { font-size: var(--fs-xs); }
body.cad .ws-std { display: flex; align-items: stretch; min-height: 34px; padding: 0 8px; background: var(--cad-panel); }
body.cad .cad-std { display: flex; align-items: center; gap: 2px; padding-right: 8px; margin-right: 4px; border-right: 1px solid var(--cad-line); }
body.cad .std-btn { display: inline-grid; place-items: center; width: 30px; height: 28px; padding: 0; color: var(--text);
  background: none; border: 1px solid transparent; border-radius: var(--radius); }
body.cad .std-btn:hover:not(:disabled) { background: var(--cad-panel-2); border-color: var(--cad-line); }
body.cad .std-btn:disabled { opacity: .35; }
body.cad .std-btn.active { background: var(--cad-sel); color: var(--cad-sel-text); border-color: var(--accent); }   /* 1.46.0: the page it opened (cad_frame std.active) */
body.cad .std-btn svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
body.cad .std-open svg { color: var(--warn); }
body.cad .std-save svg { color: var(--accent); }
body.cad .ws-steps { gap: 1px; padding: 0; margin: 0; border: 0; align-items: flex-end; flex-wrap: nowrap; }
body.cad .ws-steps li a, body.cad .ws-steps li > span { border-radius: var(--radius) var(--radius) 0 0; padding: 5px 12px 6px;
  border: 0; border-bottom: 2px solid transparent; background: none; color: var(--muted); font-size: var(--fs-sm); }
body.cad .ws-steps li a:hover { background: var(--cad-panel-2); color: var(--text); }
body.cad .ws-steps li.active a { background: var(--cad-tabs); color: var(--text); border-bottom-color: var(--accent); font-weight: 600; }
body.cad .ws-steps li b { display: none; }                    /* CAD tabs carry names, not numbers */

/* ---- the page / drawing area ------------------------------------------------------------------------------------ */
body.cad main.in-ws { margin: 0; }
body.cad .card { border-radius: var(--radius-card); box-shadow: none; padding: 10px 12px; border-color: var(--cad-line); background: var(--surface); }
body.cad .card-head h1, body.cad h1 { font-size: var(--fs-lg); }
body.cad h2 { font-size: var(--fs-md); }
body.cad button, body.cad .button { border-radius: var(--radius); }
body.cad input[type=text], body.cad input[type=number], body.cad select, body.cad textarea { border-radius: var(--radius-sm); }
body.cad .photo-stage, body.cad .pw-work .photo-stage { background: var(--cad-canvas); }
body.cad .pw-toolbar.ribbon { border-radius: 0; background: var(--cad-panel); border-color: var(--cad-line); }
body.cad .pw-section { border-radius: var(--radius); background: var(--cad-panel); border-color: var(--cad-line); }
body.cad table.list th { background: var(--cad-panel-2); }

/* ---- status bar --------------------------------------------------------------------------------------------------- */
.cad-status { display: none; }
body.cad .cad-status { display: flex; align-items: stretch; height: 22px; flex: none; background: var(--cad-status); color: var(--muted);
  border-top: 1px solid var(--cad-line); font-size: var(--fs-xs); }
body.cad .cad-status > span { display: flex; align-items: center; padding: 0 10px; border-right: 1px solid var(--cad-line); white-space: nowrap; }
body.cad .cad-status .cs-grow { flex: 1; border-right: 0; }
body.cad .cad-status .cs-ok { color: var(--ok); }
body.cad .cad-status .cs-warn { color: var(--warn); }
body.cad.has-ws .site-footer { display: none; }
body.cad.fit { height: 100dvh; }

/* ---- step 3: properties palettes - the photo page's right column docked to the drawing; property rows ------------ */
.cad-palette-head { display: none; }
body.cad .cad-palette-head { display: block; position: sticky; top: 0; z-index: 2; padding: 5px 8px; background: var(--cad-panel-2);
  border-bottom: 1px solid var(--cad-line); font-size: var(--fs-xs); font-weight: 600; text-transform: uppercase;
  letter-spacing: .06em; color: var(--muted); }
body.cad .pw-work { gap: 0; }
body.cad .pw-center { padding-right: 0; }
body.cad .pw-inspector { gap: 0; background: var(--cad-panel); border: 1px solid var(--cad-line); border-left-width: 1px; }
body.cad .pw-inspector .pw-section { border: 0; border-bottom: 1px solid var(--cad-line); border-radius: 0; padding: 0; margin: 0;
  background: transparent; }
body.cad .pw-inspector details.pw-fold > summary { padding: 4px 8px; margin: 0; background: var(--surface-2); }
body.cad .pw-inspector details.pw-fold > summary h3 { font-size: var(--fs-sm); font-weight: 600; }
body.cad .pw-inspector details.pw-fold[open] > summary { margin-bottom: 0; border-bottom: 1px solid var(--cad-line); }
body.cad .pw-inspector details.pw-fold > :not(summary) { margin-left: 8px; margin-right: 8px; }
body.cad .pw-inspector .part-panel { margin: 0 !important; }
body.cad .pw-inspector .part-panel h3 { margin: 6px 8px; font-size: var(--fs-sm); }
/* the property grid: label | value, one row per property, thin lines between */
body.cad .part-grid { grid-template-columns: 46% 54%; gap: 0; font-size: var(--fs-sm); }
body.cad .part-grid > label, body.cad .part-grid > .pf { display: flex; align-items: center; min-height: 24px; margin: 0;
  padding: 1px 8px; border-bottom: 1px solid var(--cad-line); }
body.cad .part-grid > label { color: var(--muted); font-weight: 400; }
body.cad .part-grid input, body.cad .part-grid select { border-color: transparent; background: transparent; height: 22px; }
body.cad .part-grid input:hover, body.cad .part-grid select:hover, body.cad .part-grid input:focus, body.cad .part-grid select:focus {
  border-color: var(--cad-line); background: var(--input-bg); }
body.cad .part-grid .pf.missing input, body.cad .part-grid .pf.missing select { background: var(--missing-bg); border-color: var(--warn); }
body.cad .part-grid .pf.invalid input, body.cad .part-grid .pf.invalid select { background: var(--error-bg); border-color: var(--error-text); }
body.cad .part-grid .pf.na input, body.cad .part-grid .pf.na select { background: transparent; border-color: transparent; }
body.cad .pw-inspector .part-panel .danger, body.cad .pw-inspector .part-panel > button { margin: 6px 8px; }
body.cad .pw-inspector .pw-empty { padding: 6px 8px; }
/* the project data page's form as a property grid (label | value) */
body.cad #iteration-form .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 var(--sp-4); }
body.cad #iteration-form .grid > div { display: grid; grid-template-columns: 42% 58%; align-items: center; border-bottom: 1px solid var(--cad-line);
  padding: 2px 0; }
body.cad #iteration-form .grid > div > label { margin: 0; color: var(--muted); font-weight: 400; }

/* ---- 1.47.0 (owner, DESIGN_RULES §3b): the work area is a row of CARDS - left palette (inputs, settings), the working panel,
   right palette (outputs) - with one margin round each, all starting at one height; every card header is 34 px; the working
   panel's header holds its view tabs, then its toolbar ------------------------------------------------------------------- */
body.cad { --cad-gap: 8px; --cad-head: 34px; --cad-palw: 290px; }
body.cad .ws-body { display: flex; align-items: stretch; gap: var(--cad-gap); padding: var(--cad-gap); background: var(--bg); min-height: 0; }
body.cad .cad-card { display: flex; flex-direction: column; min-width: 0; min-height: 0; overflow: hidden; background: var(--cad-panel);
  border: 1px solid var(--cad-line); border-radius: var(--radius-card); box-shadow: 0 1px 3px rgba(0, 0, 0, .18); }
body.cad .ws-win { flex: 1 1 auto; }
body.cad .cad-pal { flex: none; width: var(--cad-palw); }
body.cad .cad-pal-right:not(:has(> .cad-head ~ :not([hidden]))) { display: none; }       /* no results yet: no palette */
/* the header: equally high on every card */
body.cad .cad-head { display: flex; align-items: stretch; flex: none; height: var(--cad-head); box-sizing: border-box;
  background: var(--cad-tabs); border-bottom: 1px solid var(--cad-line); min-width: 0; }
body.cad .wtabs, body.cad .cad-ptabs { display: flex; flex: none; align-items: stretch; margin: 0; }
body.cad .wtabs { border-right: 1px solid var(--cad-line); }
body.cad .cad-ptabs { flex: 1 1 auto; min-width: 0; }
body.cad .wtabs > a, body.cad .wtabs > span, body.cad .cad-ptabs > [role="tab"], body.cad .cad-ptabs > span {
  display: flex; align-items: center; justify-content: center; padding: 0 14px; font-size: var(--fs-sm); font-weight: 600; color: var(--muted);
  text-decoration: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; background: none; border: 0; border-radius: 0;
  border-bottom: 2px solid transparent; }
body.cad .cad-ptabs > * { flex: 1 1 0; min-width: 0; }
body.cad .wtabs > a:hover, body.cad .cad-ptabs > [role="tab"]:hover { color: var(--text); }
body.cad .wtabs > .active, body.cad .cad-ptabs > .active, body.cad .cad-ptabs > [aria-selected="true"] {
  color: var(--text); background: var(--cad-panel); border-bottom-color: var(--accent); }
/* the toolbar in the working panel's header: one row of symbols; a word only on the page's main command */
body.cad .cad-tb { display: flex; align-items: center; gap: 2px; flex: 1 1 auto; min-width: 0; padding: 0 6px; background: var(--cad-panel); }
body.cad .cad-tb > form, body.cad .cad-tb .tb-group { display: contents; }
body.cad .ib, body.cad .tmenu > summary { display: inline-flex; align-items: center; justify-content: center; gap: 4px; flex: none;
  height: 26px; min-width: 26px; padding: 0 4px; margin: 0; color: var(--text); background: none; border: 1px solid transparent;
  border-radius: var(--radius); font-size: var(--fs-sm); font-weight: 400; cursor: pointer; list-style: none; white-space: nowrap; }
body.cad .tmenu > summary::-webkit-details-marker { display: none; }
body.cad .ib:hover:not(:disabled), body.cad .tmenu > summary:hover { background: var(--cad-panel-2); border-color: var(--cad-line); }
body.cad .ib:disabled { opacity: .4; cursor: default; }
body.cad .ib[aria-pressed="true"], body.cad .ib.on { background: var(--cad-sel); color: var(--cad-sel-text); border-color: var(--accent); }
body.cad .ib.main { padding: 0 9px; color: var(--accent-text); background: var(--accent); border-color: var(--accent); }
body.cad .ib.main:hover:not(:disabled) { background: var(--accent); filter: brightness(1.1); }
body.cad .tb-ico { width: 16px; height: 16px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
body.cad .tb-ico .tb-fill { fill: currentColor; stroke: none; }
/* 2.1.0 (design rules v2.0 §3b): letters as symbols (F / S / T, kN), and a few choices as one group of symbols */
body.cad .tb-ico .tb-text { fill: currentColor; stroke: none; font: 600 6.5px/1 system-ui, sans-serif; text-anchor: middle; }
body.cad .tb-ico .tb-text-wide { font-size: 7.5px; }
body.cad .cad-tb .tb-seg { display: inline-flex; flex: none; align-self: center; border: 1px solid var(--cad-line); border-radius: var(--radius-sm); }
body.cad .cad-tb .tb-seg[hidden] { display: none; }
body.cad .tb-seg .ib { border-radius: 0; border-color: transparent; margin: 0; }
body.cad .tb-seg .ib + .ib { border-left: 1px solid var(--cad-line); }
body.cad .tb-seg .ib[aria-pressed="true"] { border-color: var(--accent); }
body.cad .tb-state { display: none !important; }        /* the select a group of symbols stands for - kept for its value */
body.cad .tsep { width: 1px; height: 18px; flex: none; margin: 0 4px; background: var(--cad-line); }
body.cad .cad-tb select, body.cad .cad-tb input[type=text] { height: 24px; min-width: 0; padding: 0 4px; font-size: var(--fs-sm); }
body.cad .cad-tb .tb-field { display: inline-flex; align-items: center; gap: 3px; flex: none; color: var(--muted); font-size: var(--fs-sm); }
body.cad .cad-tb .tb-field input { width: 3.6em; }
body.cad .cad-tb .tb-zoom { min-width: 3.8em; text-align: center; font-size: var(--fs-sm); font-variant-numeric: tabular-nums; }
body.cad .cad-tb .tb-spacer { flex: 1 1 auto; }
body.cad .cad-tb .chip { flex: none; }
/* drop-down menus (details.tmenu): the list opens under its button, over the page */
body.cad .tmenu { position: relative; flex: none; }
body.cad .tmenu-list { position: absolute; top: calc(100% + 4px); left: 0; z-index: 40; display: flex; flex-direction: column; gap: 2px;
  min-width: 180px; padding: 4px; background: var(--cad-panel); border: 1px solid var(--cad-line); border-radius: var(--radius);
  box-shadow: 0 6px 20px rgba(0, 0, 0, .3); }
body.cad .tmenu-list.row { flex-direction: row; min-width: 0; }
body.cad .tmenu-list > a, body.cad .tmenu-list > button, body.cad .tmenu-list > label { justify-content: flex-start; }
body.cad .tmenu-right .tmenu-list { left: auto; right: 0; }
/* the working panel's body and the palettes scroll in their own box */
body.cad .ws-win > main { flex: 1 1 auto; min-height: 0; min-width: 0; overflow: auto; padding: var(--cad-gap); box-sizing: border-box; }
body.cad .ws-win > main.pw-main-wrap { padding: 0; }
body.cad .ws-win > main > .card { border: 0; box-shadow: none; background: none; padding: 0; margin: 0 0 var(--cad-gap); }
body.cad .ws-win > main > .card > .card-head > h1 { display: none; }
body.cad .cad-pal > .cad-body { flex: 1 1 auto; min-height: 0; overflow: auto; display: flex; flex-direction: column; }
body.cad .cad-howto { flex: none; margin: 0; padding: 4px 8px; font-size: var(--fs-xs); color: var(--muted); background: var(--surface-2);
  border-bottom: 1px solid var(--cad-line); }
body.cad .cad-howto > summary { cursor: pointer; font-weight: 600; color: var(--text); }
body.cad .cad-howto p { margin: 4px 0; }
body.cad .cad-sec { flex: none; }
body.cad .cad-sec > summary, body.cad .cad-sec-head { padding: 4px 8px; margin: 0; font-size: var(--fs-sm); font-weight: 600; cursor: pointer;
  background: var(--surface-2); border-bottom: 1px solid var(--cad-line); list-style: none; }
body.cad .cad-sec > :not(summary) { margin: 6px 8px; }
/* 1.54.0 (owner, DESIGN_RULES §3b): whatever folds says so - a chevron before every folding heading, turned when open */
body.cad .cad-sec > summary { display: flex; align-items: center; gap: 6px; }
body.cad .cad-sec > summary::-webkit-details-marker { display: none; }
body.cad .cad-sec > summary::before { content: ""; flex: none; border-left: 5px solid var(--muted); border-top: 4px solid transparent;
  border-bottom: 4px solid transparent; transition: transform .12s; }
body.cad .cad-sec[open] > summary::before { transform: rotate(90deg); }
body.cad .cad-sec > .part-grid, body.cad .cad-sec > .cad-rows { margin: 0; }
body.cad .cad-rows > div { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 24px; padding: 1px 8px;
  border-bottom: 1px solid var(--cad-line); font-size: var(--fs-sm); }
body.cad .cad-rows > div > :first-child { color: var(--muted); }
body.cad .cad-rows > div > :last-child { text-align: right; font-variant-numeric: tabular-nums; }
body.cad .cad-pal .ws-nav-head, body.cad .cad-palette-head { display: none; }

/* ---- the mast switcher (row 2, per-mast steps) ------------------------------------------------------------------------- */
body.cad .msw { display: inline-flex; align-items: center; gap: 0; }
body.cad .msw-ar { display: inline-grid; place-items: center; width: 22px; height: 20px; color: var(--text); border: 1px solid var(--cad-line);
  background: var(--cad-panel); }
body.cad .msw-ar:first-child { border-radius: var(--radius) 0 0 var(--radius); }
body.cad .msw-ar:last-child { border-radius: 0 var(--radius) var(--radius) 0; }
body.cad .msw-ar.off { color: var(--muted); opacity: .45; }
body.cad .msw-ar svg { width: 12px; height: 12px; fill: none; stroke: currentColor; stroke-width: 1.8; }
body.cad .msw-pick > summary { height: 20px; min-width: 150px; padding: 0 8px; gap: 6px; justify-content: flex-start; border: 1px solid var(--cad-line);
  border-left: 0; border-right: 0; border-radius: 0; background: var(--cad-panel); }
body.cad .msw-pick > summary::after { content: "\25BE"; margin-left: auto; color: var(--muted); }
body.cad .msw-list { min-width: 260px; }
body.cad .msw-list > a { display: grid; grid-template-columns: 18px 1fr auto; column-gap: 6px; align-items: center; padding: 3px 6px;
  color: var(--text); text-decoration: none; border-radius: var(--radius-sm); }
body.cad .msw-list > a:hover { background: var(--cad-panel-2); }
body.cad .msw-list > a.current { background: var(--cad-sel); color: var(--cad-sel-text); }
body.cad .msw-list small { grid-column: 2 / span 2; color: var(--muted); font-size: var(--fs-xs); }
body.cad .ws-state svg { width: 14px; height: 14px; vertical-align: middle; }

/* ---- the photo and the site plan: the picture fills the working panel ----------------------------------------------------- */
body.cad .pw { gap: 0; height: 100%; }
body.cad #photo-work { grid-template-columns: minmax(0, 1fr); gap: 0; height: 100%; min-height: 0; }
body.cad .pw-center { gap: 0; }
body.cad .pw-work .photo-stage { background: var(--cad-canvas); }
body.cad .pw-center .photo-info { margin: 0; padding: 3px 10px; background: var(--cad-panel); border-top: 1px solid var(--cad-line); }
body.cad .pw-notice { margin: 6px 10px; }
body.cad .cad-pal .pw-inspector { overflow: hidden auto; gap: 0; border: 0; background: none; }   /* 1.53.0: the side panel scrolls as a whole */
/* 1.53.0: the parts list and the properties share the panel like every nested panel (below) */
body.cad .cad-pal-right .pw-results { border: 0; }
body.cad .cad-pal-right .pw-results > summary { position: sticky; top: 0; z-index: 1; }
body.cad .cad-pal-right .pw-summary { width: calc(100% - 16px); table-layout: fixed; }   /* 8 px side margins (pw-fold) */
body.cad .cad-pal-right .pw-summary td, body.cad .cad-pal-right .pw-summary th { overflow-wrap: anywhere; }
body.cad .cad-pal-right .pw-summary td:last-child, body.cad .cad-pal-right .pw-summary th:last-child { width: 5.5em; text-align: right; white-space: normal; }

/* ---- tables in the working panel: one alignment per column, header and cells alike (DESIGN_RULES §8) ----------------------- */
body.cad .ws-body table th.num, body.cad .ws-body table td.num { text-align: right; font-variant-numeric: tabular-nums; }

@media (min-width: 900px) and (min-height: 560px) {
  body.cad.fit > .ws-body { flex: 1 1 auto; min-height: 0; }
}
@media (max-width: 860px) {
  body.cad .ws-body { flex-direction: column; }
  body.cad .cad-pal { width: auto; }
}
/* the palettes' contents (1.47.0) */
body.cad .cad-pal .profile-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 2px var(--sp-2); }
body.cad .cad-rows > div.total { font-weight: 600; }
body.cad .calc-bar-row { display: flex; align-items: center; gap: var(--sp-2); padding: 2px 8px 6px; border-bottom: 1px solid var(--cad-line); }
body.cad .calc-bar-row .calc-bar { flex: 1; margin: 0; }
body.cad .calc-notes { display: block; padding: 4px 8px; }
body.cad .rp-mast { padding: 4px 8px; border-bottom: 1px solid var(--cad-line); }
body.cad .rp-mast .rp-pick { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-1); margin-top: 2px; }
body.cad .rp-mast p { margin: 2px 0 0; font-size: var(--fs-xs); }
body.cad .rp-list > div { align-items: flex-start; padding: 4px 8px; }
body.cad .cad-note { padding: 0 8px; }
/* Correx: the drawing fills the working panel */
body.cad .ws-win .cx { display: flex; flex-direction: column; align-items: stretch; min-height: 0; }   /* 1.45.1: app.css' start shrank the drawing to its canvas */
body.cad .ws-win .cx-scroll { width: 100%; box-sizing: border-box; }
body.cad .ws-win .cx-stage-card { display: flex; flex-direction: column; min-height: 0; flex: 1 1 auto; }
body.cad .ws-win .cx-scroll { max-height: none; flex: 1 1 auto; min-height: 0; }
body.cad .cx-file-btn .rb-label { max-width: 14em; overflow: hidden; text-overflow: ellipsis; }
body.cad .cad-pal .cx-texts { max-height: none; }
@media (min-width: 900px) and (min-height: 560px) {
  body.cad.fit .ws-win > main { display: flex; flex-direction: column; }
  body.cad.fit .ws-win > main > *:not(.fit-fill) { flex: none; }
}
body.cad .ws-body td.num input { text-align: right; }      /* a number in an input stands right, like its column */
/* the masts list fits the working panel at 1366 px: denser cells and number fields */
body.cad table.masts th, body.cad table.masts td { padding: 3px 5px; }
body.cad table.masts input.w-num { width: 4.6em; }
body.cad table.masts input.w-short { width: 3.6em; }
body.cad table.masts input.w-name { width: 7em; }
body.cad table.masts .btn-row { flex-wrap: nowrap; }
body.cad .cad-tb #calc-profile { width: 7em; }
body.cad .cad-tb #calc-orient { width: 7.5em; }

/* 1.46.0 (owner, DESIGN_RULES v1.5 §3b): the structure designer as cards (cad_frame) - the working panel holds the 3D view
   or the segment table edge to edge; the left card the inputs, the right card the results; each scrolls in its own box */
body.cad .ws-win > main.s3d-main { display: flex; flex-direction: column; padding: 0; overflow: hidden; }
body.cad main.s3d-main .s3d-editor { margin: 0; }                      /* the form holds only hidden fields here */
body.cad .s3d-window { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }
body.cad .s3d-pane { flex: 1 1 auto; min-height: 0; position: relative; }
body.cad .s3d-pane[hidden] { display: none; }
body.cad .s3d-pane .s3d-stage-wrap { position: absolute; inset: 0; }
body.cad .s3d-pane .s3d-stage-edit { height: 100%; border: 0; border-radius: 0; background: var(--cad-canvas); }
body.cad .s3d-pane-table { overflow: auto; padding: 8px 10px; }
body.cad .s3d-pane-table .table-scroll { max-height: none; }
body.cad .s3d-ppanel .s3d-nav, body.cad .s3d-ppanel .s3d-inspector, body.cad .s3d-ppanel .s3d-member { padding: 6px 8px; margin: 0; }
body.cad .s3d-ppanel .s3d-nav { gap: 6px; }
body.cad .s3d-ppanel .s3d-typeinfo { margin: 6px 8px; padding: 4px 8px; font-size: var(--fs-sm); }
body.cad .s3d-ppanel .s3d-tabs { flex-wrap: wrap; }
body.cad .s3d-ppanel .s3d-inspector .table-scroll { overflow-x: auto; }
body.cad .s3d-ppanel .s3d-done { margin: 6px 8px; }
body.cad .s3d-ppanel .s3d-view-actions { margin: 6px 8px; flex-wrap: wrap; }
body.cad .s3d-member h4 { margin: 6px 0 2px; font-size: var(--fs-sm); }
body.cad .s3d-results-body { padding: 6px 8px; font-size: var(--fs-sm); }
body.cad .cad-pal-right .cad-sec > .facts, body.cad .cad-pal-right .cad-sec > .s3d-checks { font-size: var(--fs-sm); }
body.cad .cad-pal-right .s3d-sections { width: calc(100% - 16px); font-size: var(--fs-sm); }
/* ---- 1.47.0 (owner, DESIGN_RULES §3b v1.5): WIRE - Wires and sag (sag.html) as cards: the inputs card (a property grid in
   collapsible groups), the working panel (view tabs + toolbar in its header; the drawing fills it), the results card
   (results and the wire load as tabs in its header) -------------------------------------------------------------------- */
body.cad.sag-cad .ws-win > main.sag-main { padding: 0; }
body.cad.sag-cad .sag-left .sag-inputs { margin: 0; padding: 0 0 8px; border: 0; border-radius: 0; box-shadow: none; background: transparent; }
body.cad.sag-cad .sag-inputs .sag-main-choice { display: grid; gap: 2px; margin: 0; padding: 6px 8px; font-size: var(--fs-sm); }
body.cad.sag-cad .sag-inputs .plan-check { margin: 0; padding: 2px 8px 6px; font-size: var(--fs-sm); }
body.cad.sag-cad .sag-group { margin: 0; border-top: 0; border-bottom: 1px solid var(--cad-line); }
body.cad.sag-cad .sag-group > summary { padding: 4px 8px; background: var(--cad-panel-2); color: var(--text); font-size: var(--fs-sm); }
body.cad.sag-cad .sag-group[open] > summary { border-bottom: 1px solid var(--cad-line); }
body.cad.sag-cad .sag-fields { padding: 0; }
body.cad.sag-cad .sag-inputs .sag-field { grid-template-columns: 54% 46%; gap: 0; margin: 0; min-height: 24px; padding: 1px 8px;
  border-bottom: 1px solid var(--cad-line); font-size: var(--fs-sm); }
body.cad.sag-cad .sag-field .sag-name { color: var(--muted); }
body.cad.sag-cad .sag-field input, body.cad.sag-cad .sag-field select { height: 22px; border-color: transparent; background: transparent; }
body.cad.sag-cad .sag-field input:hover, body.cad.sag-cad .sag-field select:hover, body.cad.sag-cad .sag-field input:focus,
body.cad.sag-cad .sag-field select:focus { border-color: var(--cad-line); background: var(--input-bg); }
body.cad.sag-cad .sag-field.field-error input, body.cad.sag-cad .sag-field.field-error select { background: var(--error-bg); border-color: var(--error-text); }
body.cad.sag-cad .sag-field .sag-hint { padding: 2px 0 4px; font-size: var(--fs-xs); }
body.cad.sag-cad .sag-submit { padding: 6px 8px; }
/* the three systems' step tabs carry their pictograms (owner) */
body.cad.sag-cad .ws-steps a.sag-step { display: inline-flex; align-items: center; gap: 8px; }
body.cad.sag-cad .ws-steps .sag-picto { width: 34px; height: 17px; }
body.cad.sag-cad .ws-steps li.active .sag-picto { stroke: var(--accent); }
/* the header's toolbar: the drawing's scale note in one line after the icons */
body.cad.sag-cad .sag-tb-note { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: var(--fs-xs); }
/* the working panel: the open view fills it */
body.cad.sag-cad .sag-window { display: flex; flex-direction: column; flex: 1 1 auto; min-height: 0; }
body.cad.sag-cad .sag-window > .error, body.cad.sag-cad .sag-window > .notice { flex: none; margin: 6px 8px; }
body.cad.sag-cad .sag-window > .sag-view { flex: 1 1 auto; min-height: 0; overflow: auto; background: var(--cad-canvas); }
body.cad.sag-cad .sag-pane { padding: 8px 10px; }
body.cad.sag-cad .sag-pane-drawing:not([hidden]) { display: flex; height: 100%; box-sizing: border-box; }
body.cad.sag-cad .sag-pane-drawing .sag-drawing { flex: 1 1 auto; min-height: 0; margin: 0; display: flex; align-items: center;
  justify-content: center; border-color: var(--cad-line); }
body.cad.sag-cad .sag-pane-drawing .sag-span { width: 100%; height: 100%; max-width: none; }
body.cad.sag-cad .sag-charts { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: var(--sp-4); }
body.cad.sag-cad .sag-pane thead th { position: sticky; top: -8px; background: var(--cad-panel-2); z-index: 1; }
/* the results card: there once there are results */
body.cad .cad-pal-right.sag-right[hidden] { display: none; }
body.cad .sag-right .sag-props { display: grid; grid-template-columns: 58% 42%; margin: 0; font-size: var(--fs-sm); }
body.cad .sag-right .sag-props dt, body.cad .sag-right .sag-props dd { margin: 0; padding: 2px 8px; border-bottom: 1px solid var(--cad-line); }
body.cad .sag-right .sag-props dt { color: var(--muted); }
body.cad .sag-right .sag-props dd { text-align: right; font-variant-numeric: tabular-nums; }
body.cad .sag-right table.list { width: 100%; font-size: var(--fs-sm); }
body.cad .sag-right .sag-pad { padding: 4px 8px; margin: 0; }
body.cad .sag-right .sag-load-panel .sag-save { padding: 8px; margin: 0; border: 0; box-shadow: none; background: transparent; }
body.cad .sag-right .sag-load-panel .sag-cols { grid-template-columns: 1fr; gap: var(--sp-2); }


/* ---- 1.48.0 (DESIGN_RULES v1.5 §3b): the part editor (admin_part_template.html) as cards - blocks + properties in the
   left palette, the sketch / 3D in the working panel (its header: Side / Plan / 3D, then the toolbar), the results in the
   right palette ---------------------------------------------------------------------------------------------------- */
body.cad.pt-cad .ws-win > main.pt-main { display: flex; flex-direction: column; padding: 0; }
body.cad.pt-cad .cad-tb .tb-group[hidden] { display: none; }
body.cad.pt-cad .cad-tb .pt-sk-snap { width: 6em; }
body.cad.pt-cad .cad-tb #pt-case3d { max-width: 11em; }
body.cad.pt-cad .pt-more { min-width: 240px; }
body.cad.pt-cad .pt-more > form { display: flex; align-items: center; gap: 4px; margin: 0; }
body.cad.pt-cad .pt-copy-row input[type=text] { flex: 1 1 auto; min-width: 0; height: 24px; }
body.cad.pt-cad .pt-more .pt-del { color: var(--error-text); }
body.cad.pt-cad .pt-window:not([hidden]) { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }
body.cad.pt-cad .pt-view:not([hidden]) { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }
body.cad.pt-cad #pt-sketch-box { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }
body.cad.pt-cad #pt-sketch-box .pt-sk-svg { flex: 1 1 auto; height: auto; min-height: 240px; border: 0; border-radius: 0;
  background: var(--cad-canvas); }
body.cad.pt-cad #pt-sketch-box .pt-sk-info { padding: 3px 10px; background: var(--cad-panel); border-top: 1px solid var(--cad-line); }
body.cad.pt-cad #pt-win-3d .pt-stage { flex: 1 1 auto; height: auto; min-height: 240px; }
body.cad.pt-cad #pt-win-3d .pt-3dhint { margin: 0; padding: 3px 10px; background: var(--cad-panel); border-top: 1px solid var(--cad-line); }
/* the other steps: their form scrolls in the working panel */
body.cad.pt-cad .ws-win > main > .pt-pane.card:not([hidden]) { flex: 1 1 auto; min-height: 0; overflow: auto; margin: 0; padding: var(--cad-gap) 12px; }
body.cad.pt-cad .ws-win > main > .ok, body.cad.pt-cad .ws-win > main > .error, body.cad.pt-cad .ws-win > main > .notice { flex: none; margin: 6px 10px; }
/* left palette: the blocks list over the open block's properties, each scrolls on its own */
body.cad.pt-cad .cad-pal > .cad-body[hidden] { display: none; }
body.cad.pt-cad .pt-pal-blocks { overflow: hidden; }
body.cad.pt-cad .pt-blocks-list { flex: 1 1 45%; min-height: 0; overflow: auto; padding: 6px 8px; }
body.cad.pt-cad .pt-props { flex: 1 1 55%; min-height: 0; overflow: auto; }
body.cad.pt-cad .pt-props .pt-insp { padding: 6px 8px 10px; gap: 6px; }
body.cad.pt-cad .pt-props-empty { padding: 6px 8px; margin: 0; }
body.cad.pt-cad .pt-blocklist { gap: 2px; grid-template-columns: minmax(0, 1fr); }     /* long summaries end in "…", never widen the palette */
body.cad.pt-cad .pt-brow { border-radius: var(--radius-sm); border-color: var(--cad-line); }
body.cad.pt-cad .pt-brow.open .pt-bhead { background: var(--cad-sel); color: var(--cad-sel-text); }
body.cad.pt-cad .pt-bhead { padding: 2px 6px; font-size: var(--fs-sm); }
body.cad.pt-cad .pt-tpl-grid { display: grid; }
body.cad.pt-cad .pt-pal-note { margin: 6px 8px; }
/* right palette: the results, its tabs in the header; it appears once the part has been built (a load or a finding) */
body.cad.pt-cad .cad-pal-right.pt-results { display: none; }
body.cad.pt-cad .cad-pal-right.pt-results:has(#pt-res tr, #pt-checks li) { display: flex; }
body.cad.pt-cad .pt-rtabs > [role="tab"] { padding: 0 6px; gap: 4px; }
body.cad.pt-cad .pt-results .cad-ppanel { padding: 4px 8px 8px; }
body.cad.pt-cad .pt-results .cad-ppanel[hidden] { display: none; }
body.cad.pt-cad .pt-building { margin: 0; padding: 0 8px; min-height: 0; }
body.cad.pt-cad .pt-building:empty { display: none; }
body.cad.pt-cad .pt-lasterr { margin: 0; padding: 0 8px 6px; }
body.cad.pt-cad .pt-lasterr:empty { display: none; }
/* the loads table: seven columns in the 290 px palette - dense cells, the numbers right (§8) */
body.cad.pt-cad .pt-results table.pt-res { width: 100%; font-size: var(--fs-xs); }
body.cad.pt-cad .pt-results table.pt-res th, body.cad.pt-cad .pt-results table.pt-res td { padding: 2px; }
body.cad.pt-cad .pt-results table.pt-res th:first-child, body.cad.pt-cad .pt-results table.pt-res td:first-child { white-space: normal; overflow-wrap: anywhere; }

/* ---- 1.49.0 (owner): "open project" / "new project" in the CAD frame - the hub as cards ------------------------------- */
body.cad .cad-pal .hub-rail { padding: var(--cad-gap); border: 0; background: none; gap: var(--cad-gap); }
body.cad .cad-pal .hub-list { overflow: visible; }
body.cad main.hub-main { flex: 1 1 auto; margin: 0; padding: var(--cad-gap); }
body.cad .hub-its { display: grid; gap: 0; border: 1px solid var(--cad-line); border-radius: var(--radius); background: var(--surface); }
body.cad .hub-its .hub-it { padding: 6px 8px; border-bottom: 1px solid var(--cad-line); margin: 0; border-radius: 0; }
body.cad .hub-its .hub-it:last-child { border-bottom: 0; }
body.cad .hub-thumbs { margin-top: var(--cad-gap); gap: var(--cad-gap); }
body.cad .cad-pal .hub-assign { width: 100%; font-size: var(--fs-sm); }
body.cad .cad-pal .hub-assign td, body.cad .cad-pal .hub-assign th { padding: 3px 4px; }
body.cad .hub-assign-form { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-1); }
body.cad .hub-assign-form button { grid-column: 1 / -1; }
body.cad .cad-pal .cad-rows > div > :last-child { overflow-wrap: anywhere; }
/* the new-project form as a property grid in the working panel */
body.cad .np-form { max-width: 760px; }
body.cad .np-form .part-grid { grid-template-columns: 30% 70%; }
body.cad .np-form .part-grid .line-list { width: 100%; height: auto; }
/* 1.50.0 (owner): the new-project card sits in the middle of the work area, as wide and as high as its form */
body.cad.np-page .ws-body { justify-content: center; align-items: center; }
body.cad.np-page .ws-win { flex: 0 1 auto; width: min(720px, 100%); max-height: 100%; }
body.cad.np-page .ws-win > main { flex: 0 1 auto; }
body.cad.np-page .np-form { max-width: none; }
body.cad .np-form .part-grid input, body.cad .np-form .part-grid select { border-color: var(--cad-line); background: var(--input-bg); }   /* a form filled from scratch: fields visible */
body.cad .np-form .pf.np-line, body.cad .np-form .pf.np-km { flex-direction: column; align-items: stretch; gap: 2px; padding-top: 3px; padding-bottom: 3px; }
/* 1.51.0 (owner): the new-project card as a dialog - close top right, create bottom right */
body.cad.np-page .cad-tb { justify-content: flex-end; }
body.cad .np-foot { display: flex; justify-content: flex-end; padding: var(--cad-gap) 0 0; margin-top: var(--cad-gap); border-top: 1px solid var(--cad-line); }

/* ---- 1.51.0 (owner): the parts step's views as symbol tabs 2D | 3D | table; the 3D model in the working panel ----------- */
body.cad .wtabs > button { display: flex; align-items: center; justify-content: center; min-width: 40px; padding: 0 12px; margin: 0;
  color: var(--muted); background: none; border: 0; border-radius: 0; border-bottom: 2px solid transparent; cursor: pointer; }
body.cad .wtabs > button:hover:not(:disabled) { color: var(--text); }
body.cad .wtabs > button.active { color: var(--text); background: var(--cad-panel); border-bottom-color: var(--accent); }
body.cad .wtabs > button:disabled { opacity: .4; cursor: default; }
body.cad .wtabs > a { min-width: 40px; }
body.cad .wtabs .tb-ico { width: 16px; height: 16px; }
body.cad .pw-m3d { flex: 1 1 auto; min-height: 0; border: 0; border-radius: 0; background: var(--cad-canvas); }
body.cad .pw-m3d .m3d-svg { height: 100%; }
body.cad .m3d-tools select { max-width: 9em; }
body.cad .m3d-info { padding: 6px 8px; }
body.cad .m3d-info h3 { font-size: var(--fs-sm); margin: 0 0 4px; }
body.cad .tmenu-list label.ib { gap: 6px; }
body.cad .m3d-info > *, body.cad .cad-pal-right .pw-results > * { flex: none; }   /* stacked, never squeezed into each other */
/* the 3D tab: the 2D diagram's controls in the results card step aside - the 3D toolbar chooses what is drawn */
body.cad.p3d #res-recipe, body.cad.p3d #res-loads { display: none; }
/* 1.53.0 (owner): the right card is ONE scroll area - the results, the choice (2D and 3D alike), the 3D part */
body.cad .cad-pal-right:has(> .pw-rscroll):not(:has(.pw-rscroll > :not([hidden]))) { display: none; }
body.cad .pw-rscroll > .pw-results, body.cad .pw-rscroll > .m3d-info { flex: none; display: flex; flex-direction: column; }
body.cad .pw-rscroll > .m3d-info:not(:first-child) { border-top: 1px solid var(--cad-line); }
body.cad .pw-kinds .kind-3d { border-style: dashed; }
/* what is shown, top left of the 2D and the 3D view */
body.cad .pw-center { position: relative; }
body.cad .view-caption { position: absolute; left: 8px; top: 8px; z-index: 5; max-width: calc(100% - 16px); pointer-events: none;
  padding: 4px 9px; border: 1px solid var(--cad-line); border-radius: 5px; background: color-mix(in srgb, var(--cad-panel) 92%, transparent);
  box-shadow: 0 1px 3px rgba(0, 0, 0, .08); font-size: var(--fs-sm); line-height: 1.35; }
body.cad .view-caption .vc-k { display: inline-block; padding: 0 5px; margin-right: 4px; border-radius: 3px; font-weight: 600;
  background: var(--accent-bg); color: var(--accent); }
body.cad .view-caption .vc-1 { font-weight: 600; }
body.cad .view-caption .vc-2 { color: var(--muted); }
body.cad .view-caption.vc-none .vc-k { background: var(--bg); color: var(--muted); }

/* 1.53.0 Correx: placing the stamps by the mast's number - the question and the places found */
body.cad .cx-stage-card { position: relative; }
body.cad .cx-place { position: absolute; left: 50%; top: 10px; transform: translateX(-50%); z-index: 6; display: flex; gap: 8px; align-items: center;
  max-width: calc(100% - 24px); padding: 6px 10px; border: 1px solid var(--accent); border-radius: 6px; background: var(--cad-panel);
  box-shadow: 0 2px 8px rgba(0, 0, 0, .18); font-size: var(--fs-sm); }
body.cad .cx-layer.cx-asking { cursor: crosshair; }
body.cad .cx-cand { position: absolute; border: 2px solid var(--accent); border-radius: 3px; background: color-mix(in srgb, var(--accent) 18%, transparent);
  pointer-events: none; }

/* 1.53.0 (owner): every item of a toolbar on one centre line - a label (the reference length) or a form control must not
   bring its form margin into the header */
body.cad .cad-head :is(label, select, input, button, a, details, summary, form, span) { margin-top: 0; margin-bottom: 0; }
body.cad .cad-tb > *, body.cad .cad-tb .tb-group > *, body.cad .cad-tb > form > * { align-self: center; }
/* 1.53.0 (owner): the property grid - label and value of a row share one height, so their lines meet */
body.cad .part-grid { align-items: stretch; }
/* 1.53.0 (owner): the side panels' width - dragged at their inner edge (page.js), kept in this browser */
body.cad .cad-pal { position: relative; }
body.cad .cad-pal > .cad-grip { position: absolute; top: 0; bottom: 0; width: 7px; z-index: 8; cursor: col-resize; touch-action: none; }
body.cad .cad-pal-left > .cad-grip { right: 0; }
body.cad .cad-pal-right > .cad-grip { left: 0; }
/* the cue (owner): a thin line along the edge and a grip in its middle - the edge can be dragged */
body.cad .cad-pal > .cad-grip::before { content: ""; position: absolute; top: var(--cad-head); bottom: 0; left: 50%; width: 1px;
  background: var(--cad-line); opacity: .7; }
body.cad .cad-pal > .cad-grip::after { content: ""; position: absolute; top: 50%; left: 50%; width: 4px; height: 28px; transform: translate(-50%, -50%);
  border-radius: 2px; background: radial-gradient(circle, var(--muted) 1px, transparent 1.4px) 0 0 / 4px 5px; opacity: .8; }
body.cad .cad-pal > .cad-grip:hover, body.cad .cad-pal > .cad-grip.dragging { background: color-mix(in srgb, var(--accent) 35%, transparent); }
body.cad .cad-pal > .cad-grip:hover::after, body.cad .cad-pal > .cad-grip.dragging::after { background: radial-gradient(circle, var(--accent) 1px, transparent 1.4px) 0 0 / 4px 5px; opacity: 1; }
body.cad.cad-resizing, body.cad.cad-resizing * { cursor: col-resize !important; user-select: none; }
@media (max-width: 860px) { body.cad .cad-pal > .cad-grip { display: none; } }
/* 1.53.0 (owner): the results card's content keeps the panels' 8 px margin left and right, like every other card */
body.cad .pw-rscroll > .pw-results { padding: 0 var(--cad-gap) var(--cad-gap); }
body.cad .cad-pal-right .pw-rscroll .pw-summary { width: 100%; margin-left: 0; margin-right: 0; }
/* 1.53.0 (owner): the top bar's links and their count chip (ADMIN 2) on one centre line */
body .topbar .nav { display: inline-flex; align-items: center; gap: 5px; line-height: 1.2; }
body .topbar .nav .chip { display: inline-flex; align-items: center; margin: 0; padding: 1px 6px; line-height: 1.2; font-size: 11px; vertical-align: middle; }
/* 1.53.0 (owner): no scrollbar that is not needed - a table in a fold keeps its 8 px margins INSIDE the fold's width */
body.cad .pw-fold > table { width: calc(100% - 2 * var(--cad-gap)); box-sizing: border-box; }

/* 1.53.0 (owner): panels in a panel (the folds of a side panel) - an open one is as high as its content, without a scrollbar
   while there is room; when there is not, they share the height (each scrolls only itself). The line between two open ones
   can be dragged (page.js: .fold-grip, kept per view; double click: automatic again). */
body.cad .cad-pal > .cad-body > details { flex: 0 0 auto; min-height: 0; }
/* (owner) an open one is as high as its content - never a scrollbar of its own; when the panel is too short, the side panel
   scrolls as a whole. Only a height the user dragged (inline, page.js) makes it scroll inside. */
body.cad .cad-pal > .cad-body > details[open] { flex: 0 0 auto; overflow: visible; }
body.cad .cad-pal > .cad-body > details[open][style*="height"] { overflow: auto; }
body.cad .cad-pal > .cad-body > details:not([open]) { height: auto !important; flex: 0 0 auto !important; }
body.cad .cad-pal > .cad-body > .fold-grip { display: none; flex: none; position: relative; z-index: 3; height: 7px; margin: -3px 0 -4px;
  cursor: row-resize; touch-action: none; }
body.cad .cad-pal > .cad-body > details[open] + .fold-grip:has(+ details[open]) { display: block; }
body.cad .cad-pal > .cad-body > .fold-grip::after { content: ""; position: absolute; left: 50%; top: 50%; width: 28px; height: 4px;
  transform: translate(-50%, -50%); background: radial-gradient(circle, var(--muted) 1px, transparent 1.4px) 0 0 / 5px 4px; opacity: .8; }
body.cad .cad-pal > .cad-body > .fold-grip:hover, body.cad .cad-pal > .cad-body > .fold-grip.dragging {
  background: color-mix(in srgb, var(--accent) 35%, transparent); }
body.cad .cad-pal > .cad-body > .fold-grip:hover::after, body.cad .cad-pal > .cad-body > .fold-grip.dragging::after {
  background: radial-gradient(circle, var(--accent) 1px, transparent 1.4px) 0 0 / 5px 4px; opacity: 1; }
body.cad.cad-resizing-v, body.cad.cad-resizing-v * { cursor: row-resize !important; user-select: none; }
/* 1.53.0 (owner): the margin at the bottom too - scrolled to its end, a panel's content keeps 8 px from the card's edge */
body.cad .cad-pal > .cad-body:not(:has(> details)) { padding-bottom: var(--cad-gap); }
body.cad .cad-pal > .cad-body > details[open] { padding-bottom: var(--cad-gap); }
