/* Form Designer (ADR-037 §9.10): Library, Canvas and Inspector.
   Loaded after window.css (the order is in base.css). */
/* ---------- Form Designer (ADR-037 §9.10; FW-UI-190, M13: the accepted
   mockup's form-designer.html) ----------
   The title bar is the toolbar's row (M03): Back to Form Settings, the
   Form's name and its line, then the tools in glass capsules - Library,
   Design or Preview as, the sample record or the role, the width, Inspector,
   Discard and Save. The body holds the Library and the Inspector as glass
   panels beside the Canvas, the real record window in a frame at the chosen
   width. */
.designer .designer-bar{gap:8px}
.designer-title{flex:1 1 auto;min-width:120px}
.designer-title>small{display:block;overflow:hidden;font:var(--type-mac-caption);font-weight:400;color:var(--label-2);white-space:nowrap;text-overflow:ellipsis}
.designer-status:not(:empty)::before{content:" · "}
/* The bar's segmented controls keep their track and 22 px segments, and a
   panel's button that is on reads in the accent (the mockup's .tb-seg and
   .tb-btn.on; M13's CSS check). */
.designer-bar .segmented.tb-seg{height:var(--tb-item);padding:3px 2px;background:var(--fill-2)}
.designer-bar .segmented.tb-seg>button{min-height:22px;height:22px;padding:0 10px}
.designer-bar .tb-btn[aria-pressed="true"]{color:var(--accent-text)}
/* The Sample record pop-up is framed in the bar, as the mockup's .popup.tb-pop. */
.designer-bar .tb-popup select{max-width:220px;padding-left:10px;border-radius:7px;background-color:var(--control);box-shadow:0 0 0 var(--hairline-w) var(--control-line),0 .5px 2px #1d31281a}
.designer-bar .designer-narrow{display:none}
.designer-bar .designer-narrow .menu-popover{min-width:200px}
.designer-bar .designer-narrow .menu-item>.mk svg{width:16px;height:16px;fill:none;stroke:currentColor;stroke-width:1.6;stroke-linecap:round;stroke-linejoin:round}
.designer-bar .designer-narrow .menu-item.danger{color:var(--red-text)}
.designer-body{flex:1;min-height:0;display:grid;grid-template-columns:var(--designer-library,250px) minmax(0,1fr) var(--designer-inspector,298px);gap:8px;padding:0 8px 8px}
.designer-body.no-library{--designer-library:0px}
.designer-body.no-inspector{--designer-inspector:0px}
.designer-body.no-library .designer-library,.designer-body.no-inspector .designer-inspector{display:none}
.designer-body.no-library{grid-template-columns:minmax(0,1fr) var(--designer-inspector,298px)}
.designer-body.no-inspector{grid-template-columns:var(--designer-library,250px) minmax(0,1fr)}
.designer-body.no-library.no-inspector{grid-template-columns:minmax(0,1fr)}
.designer-body.no-library>.designer-canvas,.designer-body.no-inspector>.designer-canvas{grid-column:auto}
/* The panels are the window's glass (the sidebar's material). */
.designer-library,.designer-inspector{min-width:0;overflow:auto;padding:10px;border-radius:var(--r-sidebar);background:var(--glass);-webkit-backdrop-filter:blur(30px) saturate(180%);backdrop-filter:blur(30px) saturate(180%);box-shadow:var(--glass-shadow),inset 0 0 0 1px var(--glass-edge)}
.designer-library{grid-column:1}
/* The Inspector stands 8 px under the bar and from the window's edge, beside
   the body's own 8 px (the mockup's .inspector: margin 8 8 8 0; blind round
   2 of 2026-11-19). Its column is the panel's 290 px and that margin. */
.designer-inspector{grid-column:3;margin:8px 8px 8px 0;padding:14px}
.designer-body.no-library .designer-inspector{grid-column:2}
.designer-library>.segmented{display:flex;margin:0}
.designer-library>.segmented>*{flex:1;justify-content:center}
.library-search{position:relative;display:flex;align-items:center;margin:8px 0}
.library-search>svg{position:absolute;left:8px;width:13px;height:13px;fill:none;stroke:var(--label-2);stroke-width:1.7;stroke-linecap:round;stroke-linejoin:round;pointer-events:none}
.library-search>input{width:100%;height:var(--tb-item);min-height:0;margin:0;padding:0 8px 0 27px;border:0;border-radius:8px;background:var(--fill-2);font:var(--type-mac-body)}
.library-search>input::placeholder{color:var(--label-2)}
.library-search>input:focus{background:var(--control);box-shadow:0 0 0 3px var(--focus);outline:0}
.library-search>input::-webkit-search-cancel-button{display:none}
.designer-library .settings-heading{margin:14px 4px 5px;padding:0;font:var(--type-mac-caption);font-weight:600;color:var(--label-2)}
.designer-library .settings-heading small{font-weight:400}
/* A Library's group: the rows of one card, as the mockup's .group. */
.library-group{overflow:hidden;border-radius:var(--r-group);background:var(--group);box-shadow:0 0 0 var(--hairline-w) var(--group-line),0 .5px 1.5px #0000000a}
.library-group:empty{display:none}
/* A Library item: the type, the name with its line under it, a mark when placed. */
.library-item{position:relative;display:flex;align-items:center;gap:8px;width:100%;min-height:var(--row-mac);margin:0;padding:7px 12px;border:0;border-radius:0;background:none;box-shadow:none;color:var(--label);font:var(--type-mac-body);text-align:left;cursor:grab;user-select:none}
.library-item+.library-item::before{content:"";position:absolute;top:0;left:12px;right:0;height:var(--hairline-w);background:var(--field-line)}
button.library-item{cursor:default}
button.library-item:hover{background:var(--fill-hover)}
.library-item.is-placed{cursor:default}
.library-item[hidden]{display:none}
.library-type{flex:none;display:grid;place-items:center;width:22px;height:22px;border-radius:6px;background:var(--fill-2);color:var(--label-2);font:var(--type-mac-caption);font-weight:600;overflow:hidden}
.library-type svg{width:13px;height:13px;fill:none;stroke:currentColor;stroke-width:1.5;stroke-linecap:round;stroke-linejoin:round}
.library-text{flex:1;min-width:0;overflow-wrap:anywhere}
.library-text small{display:block;font:var(--type-mac-caption);font-weight:400;color:var(--label-2)}
.library-placed{flex:none;display:grid;place-items:center}
.library-placed svg{width:14px;height:14px;fill:none;stroke:var(--green);stroke-width:1.6;stroke-linecap:round;stroke-linejoin:round}
.designer-library>.window-note{margin:10px 4px 0;font:var(--type-mac-caption);color:var(--label-2)}
/* The Canvas: the record window on the page's ground, at the width chosen. */
.designer-canvas{grid-column:2;display:flex;flex-direction:column;min-width:0;min-height:0;overflow:auto;padding:16px;background:none}
.designer-canvas>.message{width:100%;max-width:1000px;margin:0 auto 12px}
.designer-frame{flex:1;width:100%;max-width:1000px;min-height:520px;margin:0 auto;transition:max-width .2s}
/* The frame keeps the width it shows; a narrow Canvas scrolls instead of
   squeezing the record window into another layout. The desktop page is
   820 px at least: a narrower Canvas shows it scaled down to fit, the layout
   inside the real desktop one, as design tools do; never past 1:1 (PO
   2026-11-18 R096c0f: «1. b»). The frame measures itself (a size
   container); the page inside is drawn at 820 and scaled to the frame. */
.designer-frame.is-desktop{container-type:size;overflow:clip;overflow-clip-margin:2px}
.designer-frame.is-desktop iframe{--fd-scale:min(1,tan(atan2(100cqw,820px)));width:max(820px,100cqw);height:calc(100cqh / var(--fd-scale));transform:scale(var(--fd-scale));transform-origin:0 0}
.designer-frame.is-tablet{max-width:768px;min-width:768px}
.designer-frame.is-phone{max-width:390px;min-width:390px}
.designer-frame iframe{display:block;width:100%;height:100%;border:0;border-radius:var(--r-group);background:var(--page);box-shadow:0 0 0 var(--hairline-w) var(--separator)}
/* The Inspector (the mockup's .inspector): what is chosen, its name, its rows. */
.designer-inspector h3{margin:0 0 2px;font:var(--type-mac-title)}
.designer-inspector .window-note{margin:0 0 10px;font:var(--type-mac-caption);font-weight:600;color:var(--label-2)}
.designer-inspector .settings-heading{margin:12px 4px 5px;padding:0;font:var(--type-mac-caption);font-weight:600;color:var(--label-2)}
.designer-inspector .settings-card{margin:0 0 10px;border:0;border-radius:var(--r-group);background:var(--group);box-shadow:0 0 0 var(--hairline-w) var(--group-line),0 .5px 1.5px #0000000a}
.designer-inspector .settings-row{position:relative;flex-wrap:nowrap;align-items:center;gap:12px;min-height:var(--row-mac);padding:7px 12px;border:0}
.designer-inspector .settings-row+.settings-row::before{content:"";position:absolute;top:0;left:12px;right:0;height:var(--hairline-w);background:var(--field-line)}
.designer-inspector .settings-row>:is(label,span,.settings-label){flex:0 0 46%;width:auto;color:var(--label);font:var(--type-mac-body)}
.designer-inspector .settings-row>div{flex:1;min-width:0;overflow-wrap:break-word;text-align:right;color:var(--label-2)}
.designer-inspector .settings-row :is(input:not([type=checkbox]),select){width:100%}
.designer-inspector .window-actions{display:flex;flex-wrap:wrap;gap:8px;margin:10px 0 0}
.designer-inspector .window-actions>.danger-button{margin-left:auto}
/* A long value (a help text) stands under its label, read from the leading edge. */
.designer-inspector .settings-row.is-stacked{flex-direction:column;align-items:stretch;gap:2px}
.designer-inspector .settings-row.is-stacked>div{text-align:left}
/* Inside the Canvas: what can be selected, the selection and the places to drop. */
[data-form-canvas] .settings-footer{display:none}
[data-form-canvas] :is([data-design-field],[data-design-block]>.window-subhead){cursor:pointer}
[data-form-canvas] [data-design-field]:hover{outline:1px dashed var(--accent);outline-offset:-1px}
[data-form-canvas] .is-design-selected{outline:2px solid var(--accent)!important;outline-offset:-2px}
[data-form-canvas] [data-design-empty]{min-height:44px;border:1.5px dashed var(--line-strong);border-radius:var(--r-lg)}
[data-form-canvas] .is-drop-into{background:var(--accent-soft);border-radius:var(--r-lg)}
[data-form-canvas] .is-drop-before{box-shadow:inset 0 2px 0 var(--accent)}
[data-form-canvas] [data-form-tab][draggable=true]{cursor:grab}
[data-form-canvas] [data-design-field] :is(input,select,textarea,button,a,label){pointer-events:none}
/* On a narrow screen a panel shown by its button slides over the edge of
   the Canvas, which stays, so fields are still dragged onto it. */
/* While something is dragged a panel over the Canvas lets it through. */
.designer-body.is-dragging :is(.designer-library,.designer-inspector){pointer-events:none;opacity:.35}
@media(max-width:900px){
 .designer-body,.designer-body.no-library,.designer-body.no-inspector{position:relative;grid-template-columns:minmax(0,1fr)}
 .designer-body>*{grid-column:1;grid-row:1}
 .designer-body .designer-library,.designer-body .designer-inspector{display:none;margin:0}
 .designer-body.show-library .designer-library,.designer-body.show-inspector .designer-inspector{display:block;position:absolute;top:0;bottom:8px;z-index:5;width:min(290px,85%);box-shadow:var(--popover-shadow),inset 0 0 0 1px var(--glass-edge)}
 .designer-body.show-library .designer-library{left:8px}
 .designer-body.show-inspector .designer-inspector{right:8px}
}
/* iPhone (the mockup's phone tools): Back, the menu of tools and Save on
   the navigation bar's line, the Form's name under them; the panels open
   over the Canvas from the menu. */
@media(max-width:700px){
 .designer-bar>.designer-back{order:-1;margin-right:auto}
 .designer-bar>.designer-wide,.designer-bar>.tb-sep{display:none}
 .designer-bar>.designer-narrow{display:flex}
 .designer-body,.designer-body.no-library,.designer-body.no-inspector{padding:0 0 8px}
 .designer-canvas{padding:8px 0}
 /* The phone shows the record at its own width: no width to choose. */
 .designer-frame,.designer-frame:is(.is-desktop,.is-tablet,.is-phone){min-width:0;max-width:none}
 .designer-frame.is-desktop{container-type:normal;overflow:visible}
 .designer-frame.is-desktop iframe{width:100%;height:100%;transform:none}
 .designer-body.show-library .designer-library,.designer-body.show-inspector .designer-inspector{top:0;bottom:8px;width:auto;left:0;right:0}
 .designer-library,.designer-inspector{padding:12px}
 .library-item{min-height:var(--row-ios);font:var(--type-ios-body)}
 .library-text small,.designer-inspector .window-note{font:var(--type-ios-footnote)}
 .designer-inspector .settings-row{min-height:var(--row-ios)}
}
