/* Customer order entry follows the supplied top / bottom measurement sheet. */
dialog.wide-dialog{width:min(920px,calc(100% - 24px))}
.order-entry>.subtitle{margin:0 0 20px}
.order-section{border:1px solid var(--line);border-radius:10px;margin-top:14px;padding:0 18px 18px}
.order-section>summary{cursor:pointer;font-weight:650;font-size:14px;padding:16px 0;color:var(--ink)}
.order-section:not([open]){padding-bottom:0}
.order-section .field{min-width:0}
.order-section textarea{resize:vertical;line-height:1.5}
.order-entry #form-error{color:var(--red);margin-top:16px;font-size:13px}
.measurement-unit{display:flex;align-items:center;gap:20px;margin-bottom:18px}
.measurement-unit>.field{min-width:140px}
.measurement-unit p{font-size:12px;line-height:1.6;color:var(--muted)}
.measurement-columns{display:grid;grid-template-columns:1fr 1fr;gap:18px}
.measurement-fields{border:1px solid var(--line);border-radius:8px;padding:14px;min-width:0;margin:0}
.measurement-fields legend{font-size:13px;font-weight:600;padding:0 6px}
.measurement-input-grid{display:grid;grid-template-columns:1fr 1fr;gap:12px}
.custom-measurement{grid-column:1/-1;display:grid;grid-template-columns:1.3fr 1fr;gap:12px}
.drawing-tools{display:flex;gap:10px;flex-wrap:wrap;margin:12px 0}
.drawing-tools .btn{cursor:pointer}
.drawing-tools label:focus-within{outline:2px solid var(--accent);outline-offset:2px}
#sheet-drawing{display:block;width:100%;height:auto;aspect-ratio:640/380;border:1px dashed #a8bfb9;border-radius:8px;background:#fff;touch-action:none;cursor:crosshair}
.drawing-help{font-size:11px;margin:8px 0 16px}
.wide-dialog .dialog-foot,.print-dialog .dialog-foot{position:sticky;bottom:0;z-index:2;background:#fff;flex-wrap:wrap}
.sheet-preview-note{font-size:12px;color:var(--muted);padding:14px 20px}
dialog.print-dialog{width:min(880px,calc(100% - 24px))}
.sheet-preview-scroll{overflow:auto;background:#e9eeec;padding:20px}
.customer-order-sheet{position:relative;width:210mm;height:297mm;flex-shrink:0;background:white;color:#111;font-family:Arial,sans-serif;box-sizing:border-box;isolation:isolate;overflow:hidden}
.sheet-template{position:absolute;inset:0;width:100%;height:100%;z-index:-1}
.sheet-value{position:absolute;display:flex;align-items:center;white-space:pre-wrap;overflow-wrap:anywhere;overflow:hidden;background:white;font-family:Arial,sans-serif;font-size:13px;font-weight:500;line-height:1.25;padding:1px 2px;box-sizing:border-box;color:#111}
.sheet-address,.sheet-description,.sheet-notes{align-items:flex-start}
.sheet-tick{background:transparent;font-size:25px;justify-content:center;font-weight:700}
.sheet-measure{justify-content:center;text-align:center;font-size:14px}
.sheet-type{justify-content:center;text-align:center;font-size:13px}
.sheet-unit{justify-content:center;font-size:10px;color:#555}
.sheet-description{font-size:12px;line-height:1.45}
.sheet-fabric-qty{font-size:11px;justify-content:center;text-align:center}
.sheet-extra{font-size:11px}
.sheet-notes{font-size:10px;line-height:1.3}
.sheet-sales{font-size:13px}
.sheet-page{font-size:13px}
.sheet-design{position:absolute;left:30.5%;top:65%;width:39%;height:19%;object-fit:contain;background:#fff}
#print-root{display:none}
#print-root.preparing-print{display:block;position:fixed;left:-300vw;top:0;pointer-events:none}
@media(max-width:760px){
 .order-section{padding:0 12px 14px}.order-section>summary{font-size:13px}
 .measurement-columns{grid-template-columns:1fr}
 .measurement-unit{align-items:flex-start;gap:12px;flex-direction:column}
 .measurement-input-grid{gap:10px}
 .measurement-fields{padding:12px}
 .wide-dialog .dialog-foot,.print-dialog .dialog-foot{gap:8px}
 .wide-dialog .dialog-foot .btn,.print-dialog .dialog-foot .btn{flex:1 1 auto}
 .sheet-preview-scroll{padding:10px}
}
@page{size:A4 portrait;margin:0}
@media print{
 html,body{margin:0!important;padding:0!important;width:210mm!important;background:white!important}
 body>*{display:none!important}
 body>#print-root{display:block!important;margin:0!important;padding:0!important;position:static!important}
 dialog,dialog::backdrop{display:none!important}
 .customer-order-sheet{width:210mm!important;height:297mm!important;margin:0!important;box-shadow:none!important;break-inside:avoid;print-color-adjust:exact;-webkit-print-color-adjust:exact}
 .customer-order-sheet img{print-color-adjust:exact;-webkit-print-color-adjust:exact}
}
.sheet-pdf-ready{margin-top:10px;color:var(--ink)}
.sheet-pdf-ready a{color:var(--accent);font-weight:600;text-decoration:underline}

/* Replace browser disclosure triangles with the shared outline chevron. */
.order-section>summary{display:flex;align-items:center;justify-content:space-between;gap:12px;list-style:none;min-height:52px}
.order-section>summary::-webkit-details-marker{display:none}
.order-section>summary::marker{content:''}
.order-section-chevron{display:grid;place-items:center;width:26px;height:26px;flex-shrink:0;color:#67867e;border-radius:6px;background:#f1f6f4}
.order-section-chevron .icon{width:16px;height:16px;transition:transform .15s ease}
.order-section[open]>summary .icon{transform:rotate(90deg)}
.order-section>summary:hover .order-section-chevron{background:#e5f0eb;color:var(--accent)}
.order-section>summary:focus-visible{outline:2px solid var(--accent);outline-offset:3px;border-radius:5px}

/* ---------- Order pages ---------- */
.order-crumbs ol{display:flex;flex-wrap:wrap;gap:6px;list-style:none;margin:0 0 14px;padding:0;font-size:14px;color:var(--muted)}
.order-crumbs li+li::before{content:'/';margin-right:6px;color:#b4c3c3}
.order-crumbs a{color:var(--accent);font-weight:600;text-decoration:none}
.order-crumbs a:hover{text-decoration:underline}
.order-crumbs [aria-current]{color:var(--ink);font-weight:600}
.order-page-head{margin-bottom:18px}
.order-page-head h1{text-wrap:balance}
.order-page-card{overflow:visible}
.order-page-card>.dialog-content,.order-page-card>form>.dialog-content{padding:28px}
.order-page-card .dialog-foot{position:sticky;bottom:0;z-index:2;background:#fff;border-radius:0 0 16px 16px;flex-wrap:wrap}
.order-page-card .quote-paper-scroll,.order-page-card .sheet-preview-scroll{border-radius:10px}

/* ---------- Editable order sheet ---------- */
.order-sheet-editor>.subtitle{margin:0 0 18px}
.sheet-order-panel{display:grid;grid-template-columns:repeat(auto-fit,minmax(170px,1fr));gap:14px 16px;padding:18px;border:1px solid var(--line);border-radius:12px;background:#f8fbfa;margin-bottom:12px}
.sheet-order-panel .sheet-garment-field{grid-column:span 2}
.sheet-panel-help{grid-column:1/-1;margin:0}
.order-sheet-editor #form-error{color:var(--red);font-size:14px;margin:4px 0 12px}
.order-sheet-editor #form-error:empty{display:none}
.sheet-editor-scroll{display:flex;justify-content:center}
.sheet-editable{box-shadow:0 1px 4px #112f3522}
.sheet-input{position:absolute;box-sizing:border-box;margin:0;padding:1px 4px;border:1px solid transparent;border-radius:3px;background:#e8f5f1d9;font:500 13px/1.25 Arial,sans-serif;color:#111;resize:none;outline:0;min-width:0;min-height:0}
textarea.sheet-input{padding-top:3px;overflow:auto}
.sheet-input:hover{border-color:#9cc9bd}
.sheet-input:focus{border-color:var(--accent);background:#fff;box-shadow:0 0 0 2px #087f7033}
.sheet-input::placeholder{color:#5d6f6b;font-weight:400}
.sheet-input[readonly]{background:transparent}
.sheet-measure-input{text-align:center;font-size:14px}
.sheet-type-input{text-align:center}
.sheet-extra-input,.sheet-date{font-size:12px}
.sheet-description-input{font-size:12px;line-height:1.45}
.sheet-notes-input{font-size:11px;line-height:1.3}
.sheet-box{position:absolute;display:grid;place-items:center;cursor:pointer;border-radius:6px}
.sheet-box input{position:absolute;inset:0;width:100%;height:100%;margin:0;opacity:0;cursor:pointer}
.sheet-box-mark{font:700 25px/1 Arial,sans-serif;color:#111;opacity:0}
.sheet-box:hover{background:#e8f5f1aa}
.sheet-box input:checked+.sheet-box-mark{opacity:1}
.sheet-box:focus-within{outline:2px solid var(--accent);outline-offset:1px}
.sheet-drawing-area{position:absolute;left:30.5%;top:65%;width:39%;height:19%}
.sheet-editable #sheet-drawing{width:100%;height:100%;aspect-ratio:auto;border:1px dashed #9cc9bd;border-radius:4px;background:#fffffff2}
.sheet-drawing-tools{position:absolute;right:4px;top:4px;display:flex;gap:4px}
.sheet-drawing-tools .btn{min-height:28px;padding:4px 8px;font-size:12px;background:#fffffff2;cursor:pointer}
.sheet-drawing-tools .btn .icon{width:14px;height:14px}
.sheet-drawing-tools label:focus-within{outline:2px solid var(--accent);outline-offset:2px}
.sheet-order-id{justify-content:flex-end;text-align:right;font-size:13px;font-weight:700;background:transparent}
@media(max-width:760px){
 .order-page-card>.dialog-content,.order-page-card>form>.dialog-content{padding:16px}
 .sheet-order-panel .sheet-garment-field{grid-column:1/-1}
 .sheet-editor-scroll{justify-content:flex-start}
}
