/* ─────────────────────────────────────────────
   AMPACITIES · calc-save.css
   Styles for the shared "Save to project" control (shared/calc-save.js),
   injected into the calculator sheet header (.vd-head .hr).
   ───────────────────────────────────────────── */
/* PDF button (relocated into the header, beside Save). Outlined to sit
   secondary to the filled copper Save button. */
.vd-pdf-btn{
  font-family:'IBM Plex Mono',monospace; font-size:10px; letter-spacing:0.14em;
  text-transform:uppercase; cursor:pointer; padding:6px 13px; margin:0 8px 0 12px;
  border:1px solid rgba(255,255,255,0.42); background:transparent;
  color:rgba(255,255,255,0.92); border-radius:2px; white-space:nowrap;
  transition:border-color .15s, color .15s;
}
.vd-pdf-btn:hover{ border-color:var(--copper,#d97757); color:var(--copper,#d97757); }

/* A locked (issued/superseded) document's Save control reads as a quiet action,
   not a call-to-action — it routes to "new revision", it doesn't save. */
.vd-save-btn.is-locked{ background:transparent; color:rgba(255,255,255,0.75); border-color:rgba(255,255,255,0.3); }

/* Phones: the injected PDF + Save buttons made the header row wider than the
   viewport (the whole sheet laid out at ~566px on a 375px screen). Let the
   header and its right-hand cluster wrap instead of forcing the width. */
@media (max-width: 700px){
  .vd .vd-head{ flex-wrap:wrap; row-gap:8px; }
  .vd .vd-head .hr{ flex-wrap:wrap; row-gap:8px; min-width:0; }
  .vd-pdf-btn{ margin-left:0; }
}

/* The old export bar's buttons (PDF/LaTeX/DOCX/CSV) are replaced by the header
   PDF button — hide them but keep the doc-number meta in that row. */
.vd-exports .xb{ display:none !important; }

.vd-save{ position:relative; display:inline-flex; }
.vd-save-btn{
  font-family:'IBM Plex Mono',monospace; font-size:10px; letter-spacing:0.14em;
  text-transform:uppercase; cursor:pointer; padding:6px 13px;
  border:1px solid var(--amp-clay-small,#b0512f); background:var(--amp-clay-small,#b0512f);
  color:#fff; border-radius:2px; white-space:nowrap; transition:opacity .15s;
}
.vd-save-btn:hover{ opacity:0.88; }
.vd-save-btn.ghost{ background:transparent; color:rgba(255,255,255,0.92); border-color:rgba(255,255,255,0.4); }
.vd-save-panel{
  position:absolute; top:calc(100% + 9px); right:0; z-index:60; width:300px;
  background:#faf9f5; color:#141413; border:1px solid #14141333;
  box-shadow:0 18px 50px rgba(0,0,0,0.30); padding:16px; border-radius:4px; text-align:left;
}
.vsp-head{ font-family:'IBM Plex Mono',monospace; font-size:10px; letter-spacing:0.18em;
  text-transform:uppercase; color:#5e5d59; margin-bottom:13px; }
.vsp-fld{ display:block; margin-bottom:12px; }
.vsp-fld > span{ display:block; font-family:'IBM Plex Mono',monospace; font-size:9.5px;
  letter-spacing:0.12em; text-transform:uppercase; color:#5e5d59; margin-bottom:5px; }
.vsp-fld select, .vsp-fld input{ width:100%; box-sizing:border-box; padding:9px 10px;
  border:1px solid #14141333; background:#fff; font-family:'Manrope',sans-serif; font-size:13px;
  color:#1a1a1a; border-radius:2px; }
.vsp-fld select:focus, .vsp-fld input:focus{ outline:none; border-color:var(--copper,#d97757); }
.vsp-actions{ display:flex; align-items:center; gap:12px; margin-top:2px; }
.vsp-save{ font-family:'IBM Plex Mono',monospace; font-size:10px; letter-spacing:0.14em;
  text-transform:uppercase; cursor:pointer; padding:9px 18px; border:1px solid #141413;
  background:#141413; color:#fff; border-radius:2px; }
.vsp-save[disabled]{ opacity:0.5; cursor:default; }
.vsp-msg{ font-family:'IBM Plex Mono',monospace; font-size:10px; letter-spacing:0.03em;
  color:#5b7046; line-height:1.3; }
.vsp-msg.err{ color:#b0512f; }

/* ── Document Card (shared/calc-doc-card.js) ────────────────────────────────
   The document cover sheet injected into #amp-doc-card on every calc sheet.
   It lives inside a .vd section's .vd-card, so surfaces + ink come from the
   glass-skin day/night tokens (--ink/--ink-fade/--copper/--hairline/--pass);
   the only literals are the day-safe fallbacks the token contract already uses.
   Field labels + inputs mirror the established .pj-fld cover-sheet styling; the
   doc-number identity keeps the mono "record" voice of the print docstamp. */
#amp-doc-card{ margin-bottom:var(--gap,18px); }
.amp-dc{ display:flex; flex-direction:column; }

/* identity band */
.amp-dc-id{ display:flex; align-items:center; flex-wrap:wrap; gap:7px 10px; }
.amp-dc-docno{ font-family:'IBM Plex Mono',ui-monospace,monospace; font-size:14px; letter-spacing:.04em; color:var(--ink); }
.amp-dc-rev{ font-family:'IBM Plex Mono',ui-monospace,monospace; font-size:12px; color:var(--ink); opacity:.85; }
.amp-dc-rev b{ font-weight:600; }
.amp-dc-sep{ opacity:.4; }
.amp-dc-chip{ font-family:'IBM Plex Mono',ui-monospace,monospace; font-size:9px; letter-spacing:.12em; text-transform:uppercase;
  padding:3px 8px; border-radius:3px; border:1px solid var(--hairline); color:var(--ink); white-space:nowrap; }
.amp-dc-chip[data-st="issued"]{ border-color:var(--pass,#5b7046); color:var(--pass,#5b7046); }
.amp-dc-chip[data-st="review"],.amp-dc-chip[data-st="pass"]{ border-color:var(--copper,#d97757); color:var(--copper,#d97757); }
.amp-dc-chip[data-st="fail"]{ border-color:var(--fail,#d23b2e); color:var(--fail,#d23b2e); }
.amp-dc-chip[data-st="superseded"]{ opacity:.55; }
.amp-dc-chip[data-st="bench"]{ border-style:dashed; opacity:.7; letter-spacing:.14em; }
.amp-dc-vf{ font-family:'IBM Plex Mono',ui-monospace,monospace; font-size:9px; letter-spacing:.1em; text-transform:uppercase;
  color:var(--pass,#5b7046); border:1px solid var(--pass,#5b7046); padding:3px 7px; border-radius:3px; white-space:nowrap; }
.amp-dc-reg{ margin-left:auto; font-family:'IBM Plex Mono',ui-monospace,monospace; font-size:10px; letter-spacing:.08em;
  text-transform:uppercase; color:var(--copper,#d97757); text-decoration:none; white-space:nowrap; }
.amp-dc-reg:hover{ text-decoration:underline; }
.amp-dc-brand{ font-size:10.5px; letter-spacing:.02em; color:var(--ink-fade,#6a6862); margin-top:7px; }
.amp-dc-brand #tb-brand-k{ color:var(--copper,#d97757); }

.amp-dc-rule{ height:1px; background:var(--hairline); margin:13px 0; border:0; }

/* field grids — mirror the established .pj-fld cover-sheet styling */
.amp-dc-grid{ display:grid; gap:11px 18px; }
.amp-dc-grid.g3{ grid-template-columns:repeat(3,minmax(0,1fr)); }
.amp-dc-grid.g4{ grid-template-columns:repeat(4,minmax(0,1fr)); }
.amp-dc-fld{ display:flex; flex-direction:column; gap:4px; min-width:0; }
.amp-dc-lbl{ font-size:9.5px; font-weight:700; letter-spacing:.1em; text-transform:uppercase; color:var(--ink-fade,#6a6862); }
.amp-dc-fld input{ border:none; border-bottom:1px solid var(--hairline); background:transparent; outline:none;
  font-family:inherit; font-size:13px; font-weight:600; color:var(--ink); padding:3px 0; border-radius:0; width:100%; box-sizing:border-box; }
.amp-dc-fld input:focus{ border-bottom-color:var(--copper,#d97757); }
.amp-dc-fld input[readonly]{ border-bottom-style:dotted; cursor:default; }
.amp-dc-val{ font-size:13px; font-weight:600; color:var(--ink); padding:3px 0; }
.amp-dc-fld-ro .amp-dc-val{ border-bottom:1px dotted var(--hairline); }
.amp-dc-issue{ display:flex; align-items:baseline; gap:9px; margin-top:11px; }
.amp-dc-issue .amp-dc-val{ padding:0; }

/* revision ladder (filled from the DB lineage by calc-save.js) */
.amp-dc-revs .amp-dc-lbl{ margin-bottom:7px; }
.amp-dc-revlist{ display:flex; flex-direction:column; gap:3px; }
.amp-dc-rrow{ display:flex; align-items:baseline; gap:12px; font-size:12.5px; color:var(--ink); }
.amp-dc-rrow .rv{ font-family:'IBM Plex Mono',ui-monospace,monospace; width:18px; flex:none; }
.amp-dc-rrow .rd{ color:var(--ink-fade,#6a6862); width:104px; flex:none; font-size:11.5px; }
.amp-dc-rrow .rr{ flex:1; min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.amp-dc-rrow .rs{ font-size:11px; color:var(--ink-fade,#6a6862); flex:none; }
.amp-dc-rrow.cur .rs{ color:var(--pass,#5b7046); }
.amp-dc-reason{ display:flex; gap:9px; align-items:baseline; margin-top:10px; }

/* ── action row (PR-5): quiet outlined controls; the primary action (issue /
   new revision) reads slightly stronger. Rendered + wired by calc-save.js. ── */
.amp-dc-actions{ display:flex; flex-wrap:wrap; align-items:center; gap:7px; margin-top:13px;
  padding-top:12px; border-top:1px solid var(--hairline); }
.amp-dc-actions[hidden]{ display:none; }   /* display:flex would otherwise beat the UA [hidden] rule */
.amp-dc-act{
  font-family:'IBM Plex Mono',ui-monospace,monospace; font-size:10px; letter-spacing:.1em;
  text-transform:uppercase; cursor:pointer; padding:5px 11px; border-radius:2px;
  border:1px solid var(--hairline); background:transparent; color:var(--ink);
  text-decoration:none; white-space:nowrap; transition:border-color .15s, color .15s;
}
.amp-dc-act:hover{ border-color:var(--copper,#d97757); color:var(--copper,#d97757); }
.amp-dc-act.primary{ border-color:var(--copper,#d97757); color:var(--copper,#d97757); font-weight:700; }
.amp-dc-act[disabled]{ opacity:.45; cursor:default; }
.amp-dc-msg{ font-size:11.5px; color:var(--ink-fade,#6a6862); flex-basis:100%; }
.amp-dc-msg.err{ color:#c0442c; }
.amp-dc-assign{ display:inline-flex; align-items:center; gap:7px; }
.amp-dc-assign select{ font:inherit; font-size:12px; padding:4px 8px; border:1px solid var(--hairline);
  border-radius:2px; background:transparent; color:var(--ink); max-width:180px; }

.amp-dc-mirror{ display:none !important; }

@media (max-width:640px){
  .amp-dc-grid.g3,.amp-dc-grid.g4{ grid-template-columns:repeat(2,minmax(0,1fr)); }
  .amp-dc-reg{ margin-left:0; }
}

/* ─────────────────────────────────────────────
   Liability line (WS1 PR-3). This file loads on calc pages ONLY — the
   proposal editor links calc-report-bw.css but not calc-save.css, so the
   printed rule below cannot leak onto proposal prints.
   ───────────────────────────────────────────── */
/* Screen: one quiet sentence wrapping to its own row of the export strip. */
.vd .vd-exports .vd-disclaim{ flex-basis:100%; line-height:1.5; }

/* Print: stamped after the report flow on every Cahier sheet. Lives on the
   .cahier-print class itself so it survives the per-solve report rebuild. */
@media print{
  body > .cahier-print::after{
    content:"A professional aid, not engineering judgement — you remain responsible for verifying every input and result against the standards that apply to your work.";
    display:block; break-inside:avoid; margin-top:3mm; padding-top:1.8mm;
    border-top:0.3mm solid var(--rule,#14141333);
    font-family:var(--mono,'JetBrains Mono',ui-monospace,monospace);
    font-size:6.4pt; line-height:1.6; letter-spacing:.06em; color:var(--ink3,#5e5d59);
  }
}
