/* Lean Sails — measurement ↔ order integration styles (Phase 2, Step A).
   Order header bar, locked banner, and save/submit toast. Scoped to the widget
   so nothing bleeds onto the host page. Palette matches measurement.css. */

.lsp-measure .lsp-m-orderbar {
  display: flex;
  flex-wrap: wrap;
  flex-direction: column;
  align-items: stretch;
  gap: 10px;
  padding: 12px 22px;
  background: #053A38;
  color: #eef3f1;
  font-family: 'Oswald', Arial, sans-serif;
  font-size: 14px;
  letter-spacing: .02em;
}
.lsp-measure .lsp-m-orderbar .lsp-m-orow { display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px 22px; }
.lsp-measure .lsp-m-orderbar .lsp-m-orow .lsp-m-change { margin-left: auto; }
.lsp-measure .lsp-m-otasks { display: flex; flex-wrap: wrap; gap: 8px; }
.lsp-measure .lsp-m-otask { display: inline-flex; align-items: center; gap: 8px; padding: 7px 13px; border-radius: 9px; border: 1px solid rgba(255,255,255,.22); background: rgba(255,255,255,.06); color: #eef3f1; font-family: 'Oswald', Arial, sans-serif; font-size: 13.5px; letter-spacing: .02em; cursor: pointer; transition: background .12s, border-color .12s; }
.lsp-measure .lsp-m-otask:hover { background: rgba(255,255,255,.14); }
.lsp-measure .lsp-m-otask.active { background: #fff; color: #053A38; border-color: #fff; }
.lsp-measure .lsp-m-otask b { font-weight: 700; }
.lsp-measure .lsp-m-otask .lsp-m-obadge { font-family: 'Nunito Sans', Arial, sans-serif; font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; padding: 2px 8px; border-radius: 999px; }
.lsp-measure .lsp-m-otask.self .lsp-m-obadge { background: #bab035; color: #053A38; }
.lsp-measure .lsp-m-otask.loft .lsp-m-obadge { background: #7fb0ac; color: #062e2c; }
.lsp-measure .lsp-m-otask.active .lsp-m-obadge { color: #053A38; }
.lsp-measure .lsp-m-otask.done { border-color: #7fb0ac; }
.lsp-measure .lsp-m-otask.done b::before { content: '\2713 '; color: #7fb0ac; font-weight: 700; }
/* required-field validation on submit (empty required fields highlighted) */
.lsp-measure .field.lsp-m-invalid input,
.lsp-measure .field.lsp-m-invalid select,
.lsp-measure .field.lsp-m-invalid textarea { border-color: #c0392b !important; background: #fdf3f2; }
.lsp-measure .field.lsp-m-invalid label { color: #c0392b; }
.lsp-measure .lsp-m-otask.active.done b::before { color: #1f7a4d; }
.lsp-measure .lsp-m-taskhint { margin: 0 0 18px; padding: 13px 18px; background: #fff6e2; border: 1px solid #e6cf9a; border-left: 4px solid #bab035; border-radius: 8px; font-family: 'Nunito Sans', Arial, sans-serif; font-size: 13.5px; line-height: 1.5; color: #5c4a12; }
.lsp-measure .lsp-m-orderbar .lsp-m-onum strong { color: #fff; font-weight: 700; }
.lsp-measure .lsp-m-orderbar .lsp-m-osails { color: #9fc0bd; text-transform: uppercase; font-size: 12.5px; letter-spacing: .06em; }

.lsp-measure .lsp-m-lockbanner {
  display: flex;
  align-items: center;
  gap: 13px;
  margin: 0 0 20px;
  padding: 18px 22px;
  background: #fff4e6;
  border: 2px solid #d98a3d;
  border-left-width: 7px;
  border-radius: 10px;
  color: #8a4b12;
  font-family: 'Nunito Sans', Arial, sans-serif;
  font-size: 16.5px;
  font-weight: 800;
  line-height: 1.42;
}
.lsp-measure .lsp-m-lockbanner .lsp-m-lockicon { flex: 0 0 auto; color: #d98a3d; display: inline-flex; }
.lsp-measure .lsp-m-lockbanner .lsp-m-locktext { flex: 1 1 auto; }

/* Revision banner — loft requested changes (Step B). Attention-grabbing but calm. */
.lsp-measure .lsp-m-revbanner {
  margin: 0 0 20px;
  padding: 16px 22px;
  background: #fdf1e6;
  border: 2px solid #c0392b;
  border-left-width: 7px;
  border-radius: 10px;
  font-family: 'Nunito Sans', Arial, sans-serif;
  color: #7a2a20;
}
.lsp-measure .lsp-m-revbanner .lsp-m-revhead {
  font-family: 'Oswald', Arial, sans-serif;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
  font-size: 16px;
  color: #c0392b;
  margin: 0 0 4px;
}
.lsp-measure .lsp-m-revbanner .lsp-m-revintro { font-size: 14px; line-height: 1.45; margin: 0; }
.lsp-measure .lsp-m-revbanner .lsp-m-revnote {
  margin: 12px 0 0;
  padding: 12px 14px;
  background: #fff;
  border-radius: 8px;
  border: 1px solid #ecccc6;
  color: #4a2e29;
  font-size: 14.5px;
  font-weight: 600;
  line-height: 1.5;
  white-space: pre-wrap;
}

/* Browse-all bar — light strip with a way back to the chooser. */
.lsp-measure .lsp-m-allbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px 16px;
  padding: 13px 22px;
  background: #eef4ec;
  border-bottom: 1px solid #cfe0d3;
  font-family: 'Nunito Sans', Arial, sans-serif;
}
.lsp-measure .lsp-m-allbar .lsp-m-allnote { color: #47605f; font-size: 13.5px; font-weight: 600; }
.lsp-measure .lsp-m-allbar .lsp-m-change { margin-left: auto; background: none; border: 0; color: #2f6f5f; font-family: 'Nunito Sans', Arial, sans-serif; font-size: 13px; font-weight: 800; text-decoration: underline; cursor: pointer; }
.lsp-measure .lsp-m-allbar .lsp-m-change:hover { color: #053A38; }
.lsp-measure.lsp-m-locked input,
.lsp-measure.lsp-m-locked select,
.lsp-measure.lsp-m-locked textarea { background: #f4f4ef; color: #555; cursor: not-allowed; }

/* A "Measurements" CTA under the order table in My Account. */
.lsp-measure-cta { margin: 18px 0 0; }

/* ── Loft "ship your sail to us" panel (loft-measured sails) ─────────────── */
.lsp-measure .lsp-m-ship { margin: 4px 0 22px; padding: 22px 24px; background: #f4f7f6; border: 1px solid #d7ddd5; border-left: 5px solid #053A38; border-radius: 12px; }
.lsp-measure .lsp-m-ship-head { font-family: 'Oswald', Arial, sans-serif; font-weight: 700; font-size: 18px; letter-spacing: .03em; color: #053A38; margin: 0 0 8px; }
.lsp-measure .lsp-m-ship-intro { font-family: 'Nunito Sans', Arial, sans-serif; font-size: 14.5px; line-height: 1.55; color: #3f4b49; margin: 0 0 14px; }
.lsp-measure .lsp-m-ship-pack { font-family: 'Nunito Sans', Arial, sans-serif; font-size: 13.5px; line-height: 1.6; color: #47605f; background: #fff; border: 1px dashed #b9c5c1; border-radius: 8px; padding: 14px 16px; margin: 0 0 18px; white-space: pre-line; }
.lsp-measure .lsp-m-ship-nlabel { display: block; font-family: 'Oswald', Arial, sans-serif; font-weight: 600; font-size: 13px; letter-spacing: .04em; text-transform: uppercase; color: #053A38; margin: 0 0 6px; }
.lsp-measure .lsp-m-ship-notes { width: 100%; box-sizing: border-box; min-height: 96px; padding: 11px 13px; font-family: 'Nunito Sans', Arial, sans-serif; font-size: 14px; line-height: 1.5; color: #1f2a29; border: 1px solid #c4ccc9; border-radius: 8px; background: #fff; resize: vertical; }
.lsp-measure .lsp-m-ship-notes:focus { outline: none; border-color: #597c7b; box-shadow: 0 0 0 3px rgba(89,124,123,.15); }
.lsp-measure .lsp-m-ship-steps { white-space: pre-line; font-family: 'Nunito Sans', Arial, sans-serif; font-size: 14px; line-height: 1.7; color: #3f4b49; background: #fff; border: 1px solid #d7ddd5; border-radius: 8px; padding: 14px 18px; }
.lsp-measure .lsp-m-ship-yournotes { margin-top: 14px; font-family: 'Nunito Sans', Arial, sans-serif; font-size: 13.5px; line-height: 1.55; color: #47605f; }
.lsp-measure .lsp-m-ship-yournotes .lsp-m-ship-nlabel { display: block; margin-bottom: 3px; }
.lsp-measure.lsp-m-locked .lsp-m-ship-notes { background: #f4f4ef; color: #555; cursor: not-allowed; }

/* ── centered confirm modal (replaces native window.confirm) ────────────── */
.lsp-m-confirm { position: fixed; inset: 0; z-index: 100000; display: none; align-items: center; justify-content: center; background: rgba(5,42,40,.45); padding: 20px; }
.lsp-m-confirm.open { display: flex; }
.lsp-m-confirm .lsp-m-confirm-box { background: #fff; border-radius: 14px; max-width: 440px; width: 100%; padding: 26px 28px; box-shadow: 0 24px 60px -18px rgba(5,42,40,.5); }
.lsp-m-confirm .lsp-m-confirm-msg { margin: 0 0 20px; font-family: 'Nunito Sans', Arial, sans-serif; font-size: 15.5px; line-height: 1.55; color: #1f2a29; }
.lsp-m-confirm .lsp-m-confirm-btns { display: flex; justify-content: flex-end; gap: 10px; }
.lsp-m-confirm .lsp-m-confirm-btns button { font-family: 'Oswald', Arial, sans-serif; font-size: 14px; letter-spacing: .03em; padding: 10px 20px; border-radius: 9px; cursor: pointer; border: 1px solid transparent; }
.lsp-m-confirm .lsp-m-confirm-cancel { background: #f1f1ea; color: #47605f; border-color: #d7ddd5; }
.lsp-m-confirm .lsp-m-confirm-cancel:hover { background: #e7e7df; }
.lsp-m-confirm .lsp-m-confirm-ok { background: #053A38; color: #fff; }
.lsp-m-confirm .lsp-m-confirm-ok:hover { filter: brightness(1.08); }

/* ── Mode chooser (Load my forms / Load all forms) ──────────────────────── */
.lsp-measure .lsp-mode { padding: 40px 22px; background: #f8f8f4; }
.lsp-measure .lsp-mode-inner { max-width: 720px; margin: 0 auto; text-align: center; }
.lsp-measure .lsp-mode h2 { font-family: 'Oswald', Arial, sans-serif; font-weight: 700; font-size: 24px; letter-spacing: .04em; text-transform: uppercase; color: #053A38; margin: 0 0 6px; }
.lsp-measure .lsp-mode-intro { font-family: 'Nunito Sans', Arial, sans-serif; font-size: 15px; color: #597c7b; margin: 0 0 24px; }
.lsp-measure .lsp-mode-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 620px) { .lsp-measure .lsp-mode-btns { grid-template-columns: 1fr; } }
.lsp-measure .lsp-mode-btns button { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; text-align: left; padding: 20px 22px; border-radius: 14px; border: 1.5px solid #d7ddd5; background: #fff; cursor: pointer; transition: border-color .12s, box-shadow .12s, transform .12s; }
.lsp-measure .lsp-mode-btns button:hover { border-color: #053A38; box-shadow: 0 10px 26px rgba(5,58,56,.12); transform: translateY(-1px); }
.lsp-measure .lsp-mode-mine { border-color: #053A38 !important; background: #053A38 !important; }
.lsp-measure .lsp-mode-mine .lsp-mode-t { color: #fff; }
.lsp-measure .lsp-mode-mine .lsp-mode-s { color: #b7cfcc; }
.lsp-measure .lsp-mode-mine:hover { box-shadow: 0 12px 30px rgba(5,58,56,.22); }
.lsp-measure .lsp-mode-mine.off { background: #eef0ec !important; border-color: #d7ddd5 !important; cursor: not-allowed; opacity: .85; transform: none; box-shadow: none; }
.lsp-measure .lsp-mode-mine.off .lsp-mode-t { color: #8a9591; }
.lsp-measure .lsp-mode-mine.off .lsp-mode-s { color: #a0aaa6; }
.lsp-measure .lsp-mode-t { font-family: 'Oswald', Arial, sans-serif; font-weight: 700; font-size: 15px; letter-spacing: .04em; text-transform: uppercase; color: #053A38; }
.lsp-measure .lsp-mode-s { font-family: 'Nunito Sans', Arial, sans-serif; font-weight: 400; font-size: 13px; line-height: 1.45; color: #597c7b; }
.lsp-measure .lsp-mode-picker { margin-top: 20px; padding-top: 18px; border-top: 1px solid #e3e6e0; }
.lsp-measure .lsp-mode-picker label { display: block; font-family: 'Oswald', Arial, sans-serif; font-weight: 700; font-size: 11.5px; letter-spacing: .08em; text-transform: uppercase; color: #053A38; margin-bottom: 8px; }
.lsp-measure .lsp-mode-pickrow { display: flex; gap: 8px; justify-content: center; }
.lsp-measure .lsp-mode-select { padding: 10px 14px; border: 1.5px solid #d7ddd5; border-radius: 8px; font-family: 'Nunito Sans', Arial, sans-serif; font-size: 14px; min-width: 260px; background: #fff; }
.lsp-measure .lsp-mode-open { padding: 10px 22px; border: 0; border-radius: 8px; background: #053A38; color: #fff; font-family: 'Oswald', Arial, sans-serif; font-weight: 700; font-size: 13px; letter-spacing: .05em; text-transform: uppercase; cursor: pointer; }

/* Sail types not in the loaded order: visible but disabled. */
.lsp-measure .chip.lsp-chip-off { opacity: .4; cursor: not-allowed; }

/* "Load different forms" link in the order bar. */
.lsp-measure .lsp-m-orderbar .lsp-m-change { margin-left: auto; background: none; border: 0; color: #b7cfcc; font-family: 'Nunito Sans', Arial, sans-serif; font-size: 13px; font-weight: 700; text-decoration: underline; cursor: pointer; padding: 0; }
.lsp-measure .lsp-m-orderbar .lsp-m-change:hover { color: #fff; }

/* ── Container-based responsiveness ──────────────────────────────────────
   The ported widget's stacking breakpoints are VIEWPORT-based (@media). When
   the widget is embedded in a narrow column — e.g. the My Account content area,
   which sits beside the account nav and is far narrower than a full page — the
   viewport is still desktop-wide, so those media queries never fire and the
   two-column diagram/form grid gets crushed (the form column collapses and its
   fields clip). Make the widget respond to its OWN width instead. Plugin-only:
   the standalone Measurement page is full-width and behaves exactly as before. */
.lsp-measure { container-type: inline-size; container-name: lspmeasure; }

@container lspmeasure (max-width: 920px) {
  .lsp-measure .main-wrap { grid-template-columns: 1fr; }
  .lsp-measure .illus-panel { position: static; }
  .lsp-measure .fr.col3 { grid-template-columns: 1fr 1fr; }
  .lsp-measure .photo-slots { grid-template-columns: 1fr 1fr; }
}
@container lspmeasure (max-width: 600px) {
  .lsp-measure .main-wrap { padding: 16px; }
  .lsp-measure .fr.col2,
  .lsp-measure .fr.col3 { grid-template-columns: 1fr; }
  .lsp-measure .submit-bar { flex-direction: column; align-items: stretch; }
  .lsp-measure .submit-note { margin-left: 0; text-align: center; }
}

/* Save / submit status toast (appended to <body>, so not scoped under .lsp-measure). */
.lsp-m-toast {
  position: fixed;
  left: 50%;
  bottom: 26px;
  transform: translate(-50%, 24px);
  z-index: 99999;
  max-width: 90vw;
  padding: 12px 22px;
  border-radius: 10px;
  background: #1f2422;
  color: #fff;
  font-family: 'Nunito Sans', Arial, sans-serif;
  font-size: 14px;
  font-weight: 700;
  box-shadow: 0 8px 30px rgba(0, 0, 0, .28);
  opacity: 0;
  pointer-events: none;
  transition: opacity .22s ease, transform .22s ease;
}
.lsp-m-toast.show { opacity: 1; transform: translate(-50%, 0); }
.lsp-m-toast.ok { background: #1f7a4d; }
.lsp-m-toast.err { background: #a3312a; }

/* ── Click-to-enlarge lightbox (ported from the prototype; dropped in the port).
   Enlarge badge is scoped to the widget; the overlay is appended to <body> so its
   classes are UNSCOPED (the widget is a CSS container and would trap position:fixed). */
.lsp-measure .illus-svg-wrap, .lsp-measure .slide-ref { cursor: zoom-in; position: relative; }
.lsp-measure .illus-svg-wrap::after, .lsp-measure .slide-ref::after {
  content: '\2922  Enlarge'; position: absolute; top: 8px; right: 10px;
  font-family: 'Oswald', Arial, sans-serif; font-size: 9px; font-weight: 700;
  letter-spacing: .08em; text-transform: uppercase; color: #597c7b;
  background: rgba(255,255,255,.85); border: 1px solid rgba(5,58,56,.22);
  border-radius: 999px; padding: 3px 9px; opacity: 0; transition: opacity .14s; pointer-events: none;
}
.lsp-measure .illus-svg-wrap:hover::after, .lsp-measure .slide-ref:hover::after { opacity: 1; }
.lsp-lightbox {
  position: fixed; inset: 0; background: rgba(5,58,56,.72);
  -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px);
  display: none; align-items: center; justify-content: center;
  padding: clamp(12px,3vw,40px); z-index: 100000;
}
.lsp-lightbox.open { display: flex; }
.lsp-lb-panel { background: #f8f8f4; border-radius: 16px; width: min(1000px,95vw); max-height: 93vh; overflow: auto; box-shadow: 0 24px 80px rgba(0,0,0,.4); }
.lsp-lb-hdr { position: sticky; top: 0; z-index: 1; background: #053A38; color: #ebebe2; padding: 13px 18px; font-family: 'Oswald', Arial, sans-serif; font-size: 13px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.lsp-lb-body { padding: 22px; display: flex; flex-direction: column; gap: 20px; }
.lsp-lb-body svg { display: block; width: 100%; height: auto; max-width: 100%; }
.lsp-lb-close { background: none; border: none; color: #ebebe2; font-size: 24px; line-height: 1; cursor: pointer; padding: 0 2px; }
.lsp-lb-close:hover { color: #bab035; }
.lsp-lb-print { margin-left: auto; margin-right: 12px; background: #bab035; color: #053A38; border: none; border-radius: 6px; font-family: 'Oswald', Arial, sans-serif; font-size: 12px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; padding: 7px 13px; cursor: pointer; }
.lsp-lb-print:hover { background: #cdc24a; }
#lsp-illus-print { display: none; }

@media print {
  /* A4, and ISOLATE the widget by ANCESTOR PATH. The form lives inside the WP/Divi
     page, so a plain window.print() prints the whole site. measurement-integration.js
     tags the widget's ancestors .lsp-print-anc on beforeprint; here we display:none
     every OFF-path sibling (collapsing its layout — the old visibility:hidden left
     ~85%-blank pages) and neutralise ancestor offsets so the form starts at the page
     origin, restoring the clean A4 the standalone prototype produced. */
  @page { size: A4; margin: 12mm; }
  body > *:not(.lsp-print-anc):not(.lsp-measure),
  .lsp-print-anc > *:not(.lsp-print-anc):not(.lsp-measure) { display: none !important; }
  .lsp-print-anc {
    position: static !important; margin: 0 !important; padding: 0 !important;
    width: auto !important; max-width: none !important; min-height: 0 !important;
    float: none !important; transform: none !important; box-shadow: none !important; background: none !important;
  }
  .lsp-measure {
    position: static !important; width: 100% !important; margin: 0 !important; left: auto; top: auto;
    container-type: normal !important; /* let measurement.css's 2-col print rule apply */
  }
  /* interactive chrome that isn't part of the printed form */
  .lsp-measure .lsp-mode,
  .lsp-measure .lsp-m-orderbar,
  .lsp-measure .lsp-m-allbar,
  .lsp-measure .lsp-m-lockbanner,
  .lsp-measure .lsp-m-revbanner { display: none !important; }
  .lsp-m-toast, .lsp-lightbox { display: none !important; }
  .lsp-measure .illus-svg-wrap::after, .lsp-measure .slide-ref::after { display: none !important; }
}

@media print {
  /* Illustration-only print (from the lightbox "Print (A4)" button): fill each A4
     page with one diagram. body.lsp-print-illus hides everything except our
     body-level print container, overriding the whole-form print rules above. */
  body.lsp-print-illus > *:not(#lsp-illus-print) { display: none !important; }
  body.lsp-print-illus #lsp-illus-print { display: block !important; position: static !important; margin: 0 !important; padding: 0 !important; background: #fff !important; }
  #lsp-illus-print .lsp-illus-page { display: flex; align-items: center; justify-content: center; box-sizing: border-box; width: 100%; min-height: 250mm; padding: 2mm; page-break-after: always; break-after: page; }
  #lsp-illus-print .lsp-illus-page:last-child { page-break-after: auto; break-after: auto; }
  #lsp-illus-print svg, #lsp-illus-print img { width: 100% !important; height: auto !important; max-width: 100% !important; max-height: 250mm !important; }
}
.lsp-measure .lsp-m-ordref {
  display: inline-block;
  margin: 0 0 14px;
  padding: 5px 12px;
  background: #eef4f3;
  border-left: 3px solid #053A38;
  border-radius: 4px;
  font-family: 'Oswald', Arial, sans-serif;
  font-size: 13px;
  letter-spacing: .02em;
  color: #053A38;
}
.lsp-measure .lsp-m-ordref strong { font-weight: 700; }
.lsp-measure .fopt { color: #8a938f; font-weight: 400; font-size: .82em; }
.lsp-measure .lsp-loft-only { display: none; }
.lsp-measure.lsp-m-loftmode .lsp-loft-only { display: grid; }
.lsp-measure .lsp-m-loftbanner {
  padding: 10px 22px;
  background: #b26a00;
  color: #fff;
  font-family: 'Oswald', Arial, sans-serif;
  font-size: 13px;
  letter-spacing: .02em;
  line-height: 1.45;
}

/* ── Functional photo slots (plugin glue enhancement) ── */
.lsp-measure .pslot { position: relative; overflow: hidden; }
.lsp-measure .pslot .lsp-ps-file { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; padding: 0; opacity: 0; cursor: pointer; z-index: 1; }
.lsp-measure .pslot.lsp-hasphoto .lsp-ps-file { pointer-events: none; }
.lsp-measure .pslot.lsp-hasphoto { border-style: solid; padding: 0; }
.lsp-measure .pslot.lsp-hasphoto .ps-icon,
.lsp-measure .pslot.lsp-hasphoto .ps-lbl,
.lsp-measure .pslot.lsp-hasphoto .ps-hint { display: none; }
.lsp-measure .pslot .lsp-ps-img { position: relative; z-index: 0; display: block; width: 100%; height: 100%; min-height: 108px; object-fit: cover; cursor: zoom-in; }
.lsp-measure .pslot .lsp-ps-rm {
  position: absolute; top: 5px; right: 5px; z-index: 2;
  width: 26px; height: 26px; border: 0; border-radius: 50%;
  background: rgba(5,58,56,.82); color: #fff; font-size: 18px; line-height: 1;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
}
.lsp-measure .pslot .lsp-ps-rm:hover { background: #053A38; }

/* Draft-saved confirmation on the submit-note (brief green emphasis). */
.lsp-measure .submit-note.lsp-m-saved { color: #1a7a4a; font-weight: 700; transition: color .2s; }
.lsp-measure .submit-note.lsp-m-saved::before { content: "✓ "; }
