/* Saving a design and My designs (Stop 42, brief §128.1; mockup 4).
   The sheets are the app's own (dialog.sab-sheet, styles.css): from the right
   above 900 px, from the bottom at 900 px and below. */

/* ── Header: My designs, a quiet outline beside Save (every screen) ── */
.hdr-mine {
  height: 44px; padding: 0 14px; display: inline-flex; align-items: center; gap: 8px; box-sizing: border-box;
  background: transparent; border: 1px solid var(--b-light); border-radius: var(--r);
  font-family: var(--f-ui); font-size: 13px; font-weight: 500; color: var(--t-dark); cursor: pointer; white-space: nowrap;
}
.hdr-mine:hover { border-color: var(--gold); }
.hdr-mine:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.hdr-mine svg { flex-shrink: 0; }
/* Where the header's row has no room for its words it is a 44 px icon, its name
   kept for a screen reader — measured with a mouse and with touch (whose
   buttons are wider), every item 4 px clear (first-minutes §8): on the design
   screens from 820 to 1139 px (the masthead row's gaps 8 px up to 900), and
   below 820 px in the grid below; off them below 768 px — and there, below
   600 px, Back is its arrow too and the row's gaps are 8 px. */
@media (max-width: 1139px) and (min-width: 820px) {
  body.sab-design .header .hdr-mine { width: 44px; padding: 0; justify-content: center; }
  body.sab-design .header .hdr-mine .hdr-lbl { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
}
@media (max-width: 900px) and (min-width: 820px) {
  body.sab-design .header-right { gap: 8px; }   /* the masthead row: the name and five buttons */
  body.sab-design .hdr-save { margin-left: 0; }
}
@media (max-width: 767px) {
  body:not(.sab-design) .header .hdr-mine { width: 44px; padding: 0; justify-content: center; }
  body:not(.sab-design) .header .hdr-mine .hdr-lbl { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
}
@media (max-width: 599px) {
  body:not(.sab-design) .header-right { gap: 8px; }
  body:not(.sab-design) #hdr-back { width: 44px; min-height: 44px; padding: 0; justify-content: center; box-sizing: border-box; }
  body:not(.sab-design) #hdr-back .hdr-lbl { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
}
/* Below 600 px (420 before Stop 51, when the account joined the row) the name, Basket and three more are wider than
   the screen. On the landing, Back gives way (My designs is the way back to a design now); on the other screens off the
   design (the basket, checkout…), My designs does. Below 360 px (the smallest phones) the name, Basket and the
   account are all the row holds off the design: My designs and Back both give way there (My designs is on every
   design screen; the name goes back to the opening screen). */
@media (max-width: 599px) {
  body:not(.sab-design):has(#s-landing.active) #hdr-back { display: none !important; }
  body:not(.sab-design):not(:has(#s-landing.active)) .header .hdr-mine { display: none; }
}
@media (max-width: 379px) {
  body:not(.sab-design) .header-right { gap: 5px; }
}
@media (max-width: 359px) {
  body:not(.sab-design) .header .hdr-mine, body:not(.sab-design) #hdr-back { display: none !important; }   /* (the name still goes back to the opening screen) */
}
/* Below 820 px the design screens' header is a grid (styles.css), five columns since Stop 51: the name (over
   three), Basket and the account, top right; the switcher, Back, Design help, My designs and Save. */
@media (max-width: 819px) {
  body.sab-design .header { grid-template-columns: minmax(0, 1fr) 44px 44px 44px 44px; }
  body.sab-design .header .logo { grid-column: 1 / 4; }
  body.sab-design .header .basket-btn { grid-column: 4; grid-row: 1; }
  body.sab-design .header .hdr-acct, body.sab-design .header .hdr-acct-wrap { grid-column: 5; grid-row: 1; align-self: center; }
  body.sab-design #hdr-back { grid-column: 2; grid-row: 2; }
  body.sab-design #hdr-help-btn { grid-column: 3; }
  body.sab-design .header .hdr-mine { grid-column: 4; grid-row: 2; width: 44px; height: 44px; padding: 0; margin: 0; justify-content: center; align-self: center; }
  body.sab-design .hdr-save { grid-column: 5; }
  body.sab-design .header .hdr-mine .hdr-lbl { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
}

/* ── Header: the account (Stop 51 item 18) — top right on every screen, after Basket; an outline like My designs ── */
.hdr-acct {
  height: 44px; min-width: 44px; padding: 0 14px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; box-sizing: border-box;
  background: transparent; border: 1px solid var(--b-light); border-radius: var(--r);
  font-family: var(--f-ui); font-size: 13px; font-weight: 500; color: var(--t-dark); text-decoration: none; cursor: pointer; white-space: nowrap;
}
.hdr-acct:hover { border-color: var(--gold); }
.hdr-acct:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.hdr-acct[hidden], .hdr-acct-wrap[hidden] { display: none; }
.hdr-acct[data-acct-wait] { visibility: hidden; }   /* (until /api/me answers: its place kept, nothing jumps) */
.hdr-acct-ico { width: 16px; height: 16px; flex: none; }
.hdr-acct .hdr-lbl { max-width: 9em; overflow: hidden; text-overflow: ellipsis; }   /* (a long first name) */
.hdr-acct-wrap { position: relative; display: inline-flex; }
/* Signed in: the member's menu, under the button, its right edge on the button's — paper, a hairline, the gold top rule. */
.hdr-acct-menu {
  position: absolute; top: calc(100% + 8px); right: 0; z-index: 300; box-sizing: border-box; width: max-content; max-width: min(300px, calc(100vw - 24px));
  padding: 14px 16px 16px; background: var(--paper); border: 1px solid var(--b-light); border-top: 2px solid var(--gold); border-radius: var(--r);
  box-shadow: 0 8px 24px rgba(20, 17, 11, 0.12); white-space: normal; text-align: left;
}
.hdr-acct-menu[hidden] { display: none; }
.hdr-acct-who { margin: 0 0 12px; font-size: 13px; line-height: 1.45; color: var(--t-mid); overflow-wrap: anywhere; }
.hdr-acct-who strong { color: var(--ink); font-weight: 600; }
.hdr-acct-menu form { margin: 0; }
/* Its words off the design screens from 768 px; else — and on the design screens at every width, whose masthead is
   full (the order switch, the view switcher and five buttons) — a 44 px icon, its name kept for a screen reader. */
body.sab-design .header .hdr-acct { width: 44px; padding: 0; }
body.sab-design .header .hdr-acct .hdr-lbl { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
@media (max-width: 767px) {
  body:not(.sab-design) .header .hdr-acct { width: 44px; padding: 0; }
  body:not(.sab-design) .header .hdr-acct .hdr-lbl { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
}
/* The room it takes on the design screens. From 1140 to 1599 px (the switcher in the masthead's row; from 1380 the
   order switch beside the name too) My designs is its icon, and below 1360 Back its arrow; from 820 to 900 px (the
   switcher on its own row) "Save this design" reads "Save" (its full name kept for a screen reader), as it does from
   901 to 1139. Below 820 px: the grid above. */
@media (max-width: 1599px) and (min-width: 1140px) {
  body.sab-design .header .hdr-mine { width: 44px; padding: 0; justify-content: center; }
  body.sab-design .header .hdr-mine .hdr-lbl { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
}
@media (max-width: 1359px) and (min-width: 1140px) {
  body.sab-design #hdr-back { min-width: 44px; justify-content: center; padding: 0; }
  body.sab-design #hdr-back .hdr-lbl { display: none; }
}
@media (max-width: 900px) and (min-width: 820px) {
  body.sab-design .hdr-save .hdr-more { display: none; }
}

/* ── My designs: the account (Stop 50) — a quiet band above the designs ── */
.md-acct { padding: 14px 16px; background: var(--cream); border: 1px solid var(--b-light); border-radius: var(--r); gap: 10px; }
.md-acct[hidden] { display: none; }
.md-acct-pane { display: flex; flex-direction: column; gap: 10px; }
.md-acct-pane[hidden] { display: none; }
.md-acct-txt { margin: 0; font-size: 13px; line-height: 1.5; color: var(--t-mid); overflow-wrap: anywhere; }
.md-acct-txt strong { color: var(--ink); font-weight: 600; }
.md-acct-acts { margin: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; }
.md-acct-acts form { margin: 0; }
.md-acct-btn { display: inline-flex; align-items: center; text-decoration: none; box-sizing: border-box; }
.md-acct-link { display: inline-flex; align-items: center; min-height: 44px; font-size: 13px; font-weight: 500; color: var(--ink); text-underline-offset: 3px; }
.md-acct-link:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }

/* Signed in, once: add this device's designs to the account (Stop 50 item 4). */
.md-adopt { display: flex; flex-direction: column; gap: 8px; padding: 12px 16px; background: var(--paper); border: 1px solid var(--gold); border-radius: var(--r); }
.md-adopt[hidden] { display: none; }
.md-resend[hidden] { display: none; }

/* ── My designs: the list, Start a new design, Resend my links ── */
.md-item { display: grid; grid-template-columns: 64px minmax(0, 1fr) auto; align-items: center; gap: 12px; }
.md-thumb { width: 64px; height: 48px; display: flex; align-items: center; justify-content: center; overflow: hidden; background: var(--paper); border: 1px solid var(--b-faint); color: var(--t-sub); }
.md-thumb img { display: block; width: 64px; height: 48px; object-fit: contain; }
.md-item .save-item-meta { line-height: 1.4; }
.md-acts { display: flex; align-items: center; gap: 4px; }
.md-new {
  width: 100%; min-height: 48px; border: 1px dashed #958872; border-radius: var(--r); background: var(--paper);
  font-family: var(--f-ui); font-size: 14px; font-weight: 500; color: var(--t-dark); cursor: pointer;
}
.md-new:hover { border-color: var(--gold); }
.md-new:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.md-said { margin: 0; font-size: 13px; line-height: 1.5; color: var(--t-mid); }
.md-said:empty { display: none; }
.md-email-lbl { display: block; margin: 0 0 6px; font-size: 13px; font-weight: 500; color: var(--t-dark); }
.md-resend-fields { display: flex; gap: 8px; }
.md-resend-fields input {
  flex: 1 1 auto; min-width: 0; height: 44px; padding: 0 12px; box-sizing: border-box;
  border: 1px solid #958872; border-radius: var(--r); background: var(--paper); font-family: var(--f-ui); font-size: 15px; color: var(--t-dark);
}
.md-resend-fields input:focus-visible { outline: 2px solid var(--ink); outline-offset: 1px; }
.md-resend-fields .btn-outline { flex-shrink: 0; }
@media (max-width: 479px) {
  .md-item { grid-template-columns: 64px minmax(0, 1fr); }
  .md-acts { grid-column: 1 / -1; justify-content: flex-end; }
  .md-resend-fields { flex-wrap: wrap; }
  .md-resend-fields .btn-outline { width: 100%; }
}

/* ── The Save sheet: three panes (the form, the update, the saved screen) ── */
.sv-pane { display: flex; flex-direction: column; flex: 1 1 auto; min-height: 0; }
.sv-pane[hidden] { display: none; }
#sheet-save .sheet-body { gap: 18px; }
#sheet-save .sheet-ft { justify-content: flex-end; gap: 10px; }
#sheet-save .sheet-ft .btn-text { margin-right: auto; }
.sv-sub[hidden], #sv-sub[hidden] { display: none; }
.sv-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.sv-field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.sv-field[hidden] { display: none; }
.sv-field label, .sv-when legend { font-size: 13px; font-weight: 500; color: var(--t-dark); }
.sv-opt { font-weight: 400; color: var(--t-sub); }
/* #958872 on paper is 3.3:1 — a field's edge that can be seen (WCAG 1.4.11). */
.sv-field input {
  height: 44px; padding: 0 12px; box-sizing: border-box; width: 100%;
  border: 1px solid #958872; border-radius: var(--r); background: var(--paper);
  font-family: var(--f-ui); font-size: 15px; color: var(--t-dark);
}
.sv-field input:focus-visible { outline: 2px solid var(--ink); outline-offset: 1px; }
.sv-field input[aria-invalid="true"] { border-color: var(--error); box-shadow: inset 0 0 0 1px var(--error); }
.sv-err { margin: 0; font-size: 12px; line-height: 1.4; color: var(--error); }
.sv-err[hidden] { display: none; }

/* "When are you hoping to start?" — four radios drawn as one row of choices. */
.sv-when { margin: 0; padding: 0; border: 0; min-width: 0; }
.sv-when legend { padding: 0; margin: 0 0 8px; }
.sv-when-opts { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.sv-when-opts label {
  position: relative; min-height: 44px; box-sizing: border-box; padding: 4px 6px;
  display: flex; align-items: center; justify-content: center; text-align: center;
  border: 1px solid var(--b-light); border-radius: var(--r); background: var(--paper);
  font-size: 12px; font-weight: 500; line-height: 1.25; color: var(--t-dark); cursor: pointer;
}
.sv-when-opts label:hover { border-color: var(--gold); }
.sv-when-opts input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.sv-when-opts label:has(input:checked) { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.sv-when-opts label:has(input:focus-visible) { outline: 2px solid var(--ink); outline-offset: 2px; }

/* The callback box, highlighted; the marketing box, plain and apart. */
.sv-call {
  display: flex; align-items: center; gap: 12px; min-height: 48px; box-sizing: border-box; padding: 10px 14px;
  background: var(--cream); border: 1px solid var(--gold); border-radius: var(--r);
  font-size: 14px; font-weight: 500; color: var(--t-dark); cursor: pointer;
}
.sv-mkt { display: flex; align-items: center; gap: 12px; min-height: 44px; font-size: 13px; line-height: 1.45; color: var(--t-mid); cursor: pointer; }
.sv-call input, .sv-mkt input { width: 20px; height: 20px; margin: 0; flex-shrink: 0; accent-color: var(--ink); cursor: pointer; }
.sv-call input:focus-visible, .sv-mkt input:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.sv-gdpr { margin: 0; font-size: 12px; line-height: 1.5; color: var(--t-sub); }
.sv-gdpr a { color: var(--ink); text-underline-offset: 2px; }
.sv-gdpr a:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.sv-status { margin: 0; font-size: 13px; line-height: 1.45; color: var(--error); }
.sv-status:empty { display: none; }
.sv-text { margin: 0; font-size: 14px; line-height: 1.55; color: var(--t-mid); }
.sv-callnote { margin: 0; padding: 12px 14px; background: var(--cream); border-left: 2px solid var(--gold); font-size: 14px; line-height: 1.5; color: var(--t-dark); }
.sv-callnote[hidden] { display: none; }
/* The link itself, to copy (while email is not connected). */
.sv-link { display: flex; flex-direction: column; gap: 8px; padding: 14px; background: var(--cream); border: 1px solid var(--b-light); border-radius: var(--r); }
.sv-link[hidden] { display: none; }
.sv-link-lbl { font-size: 13px; font-weight: 500; color: var(--t-dark); }
.sv-link-row { display: flex; gap: 8px; min-width: 0; }
.sv-link-row input {
  flex: 1 1 auto; min-width: 0; height: 44px; padding: 0 10px; box-sizing: border-box;
  border: 1px solid #958872; border-radius: var(--r); background: var(--paper);
  font-family: var(--f-mono); font-size: 12px; color: var(--t-dark);
}
.sv-link-row input:focus-visible { outline: 2px solid var(--ink); outline-offset: 1px; }
.sv-link-row .btn-outline { flex-shrink: 0; }
.sv-note { margin: 0; font-size: 13px; line-height: 1.5; color: var(--t-mid); }
/* "Send to Quote Calculator" (Stop 85, admin only; qc-send.js): its dialog's notes, the lines to price by hand, and its link out. */
#sheet-qc .sheet-body { display: grid; gap: 10px; align-content: start; }
#sheet-qc .sheet-ft { flex-wrap: wrap; gap: 8px; }
#sheet-qc a.sheet-done { display: inline-flex; align-items: center; justify-content: center; text-decoration: none; }
.qc-manual { margin: 0; padding-left: 18px; font-size: 13px; line-height: 1.5; color: var(--t-dark); max-height: 220px; overflow: auto; }

/* A phone, and the bottom sheet: one column, the four choices two by two. */
@media (max-width: 560px) {
  .sv-grid { grid-template-columns: minmax(0, 1fr); }
  .sv-when-opts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  #sheet-save .sheet-ft { flex-wrap: wrap; }
}

/* ── My designs: a view-only link (Stop 74 item 12) ── */
.md-share { grid-column: 1 / -1; }
.md-share .md-share-stop { align-self: flex-start; }

/* ── A view-only link (Stop 74 item 12; view-only.js): html.view-only ──
   The design to look at: the header is its name and who designed it; each design screen is its canvas alone — the
   3D or the plan, with the view gimbal. Everything that edits, prices, orders or draws up is not shown. */
.view-title[hidden], .view-msg[hidden] { display: none; }
.view-title { flex: 0 1 auto; min-width: 0; margin-left: auto; display: flex; flex-direction: column; align-items: flex-end; gap: 2px; text-align: right; }
.view-name { margin: 0; max-width: 100%; font-family: var(--f-head); font-size: 22px; font-weight: 400; line-height: 1.15; color: var(--t-dark); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.view-by { margin: 0; font-family: var(--f-ui); font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--t-sub); }
.view-msg { min-height: calc(100vh - 64px); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; padding: 24px 16px; box-sizing: border-box; text-align: center; background: var(--paper); }
.view-msg-title { margin: 0; font-family: var(--f-head); font-size: 28px; font-weight: 400; color: var(--t-dark); }
.view-msg-body { margin: 0; max-width: 46ch; font-size: 15px; line-height: 1.55; color: var(--t-mid); }
.view-msg-body:empty { display: none; }
.view-msg-home { text-decoration: none; }
html.view-only .header > :not(.logo):not(.view-title),
html.view-only #s-landing,
html.view-only :is(#s-room, #s-config) > :not(#jr-canvas):not(.viewer),
html.view-only #jr-price-bar,
html.view-only #rp-sel-bar > :not(#jr-gimbal):not(#rp-fit-btn),
html.view-only .viewer-tabs > :not(#jr-gimbal),
html.view-only .viewer-hint > span:last-child,
html.view-only #vpane-2d,
html.view-only .room-action-bar,
html.view-only #rp-cab-popover,
html.view-only #vs-note { display: none !important; }
/* One layout at every width: the header one row (no second row for the view switcher), the screen its canvas —
   a column of the bar that holds the gimbal at 900 px and below (app.js sabPlaceShell) and the picture. */
html.view-only body.sab-design { --hdr-h: 64px; }
html.view-only body.sab-design .header { display: flex; height: 64px; gap: 16px; }
html.view-only :is(#s-room, #s-config).active { display: block; }
html.view-only :is(#s-room, #s-config).active > :is(#jr-canvas, .viewer) { display: flex !important; flex-direction: column; position: relative; min-width: 0; height: 100%; }
html.view-only :is(.viewer-body, #room-canvas) { flex: 1 1 auto; min-height: 0; }
@media (min-width: 901px) { html.view-only .viewer-tabs { display: none; } }
@media (max-width: 768px) {
  html.view-only body.sab-design { --hdr-h: 56px; }
  html.view-only body.sab-design .header { height: 56px; }
}
@media (max-width: 600px) {
  html.view-only .logo-text { display: none; }   /* (the name is in the bar still: "Designed by Steven Andrews Bespoke") */
  .view-name { font-size: 18px; }
  .view-by { letter-spacing: 0; text-transform: none; }
}
