/* =============================================================================
   SHOP MANAGEMENT — PHONE BUILD (2026-10-13)
   The Management Home launcher, the VIN check-in, and the repair-agreement
   surfaces (shopmgmt-phone.js).
   FULL-AUDIT-20261028 (Issue 2): these surfaces were built in the dark
   "Chambers" language (warm charcoal panels, ivory text, pale-gold
   nameplates) while Shop Management is PINNED to the app light look
   (white/black + brass #C9A53F as an accent only — the parts-redesign
   language). Donny, 2026-10-28: the gold-and-black styling "clashes —
   make that look better." Restyled below to the pinned light look:
   white panels, platform text/muted/line tokens, brass kept ONLY as an
   accent (borders, focus rings, checkbox tint) and gold TEXT only in
   the dark-gold tone #7a5f1e that reads on white. Class names and layout
   are unchanged — tokens and paint only. NO backdrop-filter anywhere
   (the CFO-fix smear rule). Emergency red is not used here at all;
   nothing in these surfaces competes with it.
   On phone widths (<=820px, the app's own breakpoint) every .smp surface is
   a full-screen app page; on desktop the same markup is a large modal.
   Text follows the app's own font scale (calc with var(--font-scale)) so
   Donny's zoom/text settings are respected, with work-surface minimums.
   ============================================================================= */
/* The app's universal exit-button injector adds a .modal-x-close to every
   .modal-box; these surfaces carry their own ✕ in the nameplate head — same
   precedent as #ceoOverlay / #purchasesOverlay / #globalSearchOverlay. */
#mgmtHomeOverlay .modal-x-close, #checkinOverlay .modal-x-close, #agreementOverlay .modal-x-close { display: none; }
.smp-overlay {
  --smp-brass: #c9a53f;
  --smp-brass-hi: #7a5f1e;
  --smp-brass-dim: #b08d2f;
  --smp-line: #d8dde3;
  --smp-ivory: #1d2733;
  --smp-muted: #5d6b78;
  --smp-panel: #ffffff;
  --smp-panel2: #f6f7f9;
  --smp-serif: inherit;
  z-index: 300;
  background: rgba(20, 22, 26, 0.45);
}
#agreementOverlay { z-index: 320; }
.smp-box {
  background: #ffffff;
  color: var(--smp-ivory);
  border: 1px solid var(--smp-line);
  border-radius: 14px;
  width: 680px;
  max-width: 94vw;
  max-height: 92dvh;
  overflow-y: auto;
  padding: 18px 18px 22px;
  box-shadow: 0 24px 60px rgba(15, 20, 26, 0.28);
}
.smp-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 12px;
  border-bottom: 3px double var(--smp-brass-dim);
  padding-bottom: 10px; margin-bottom: 14px;
}
/* FULL-AUDIT-20261028: the head text block could not shrink, so on a
   390px phone the nameplate ran UNDER the top-right buttons and clipped
   ("DONNY'S AUTOMOTIV" + the ✕ on top of the E). It can shrink now, and
   the nameplate tracking is tightened at phone sizes. */
.smp-head > div { min-width: 0; }
.smp-nameplate {
  font-family: var(--smp-serif);
  font-weight: 800;
  font-size: calc(21px * var(--font-scale, 1));
  letter-spacing: 0.05em;
  color: var(--smp-brass-hi);
  overflow-wrap: break-word;
}
.smp-subtitle { color: var(--smp-muted); font-size: calc(13px * var(--font-scale, 1)); margin-top: 2px; }
.smp-close { min-width: 44px; min-height: 44px; font-size: 17px; flex: none; }

/* --- Management Home tiles ---------------------------------------------- */
.smp-tile-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.smp-tile {
  display: flex; flex-direction: column; align-items: flex-start; gap: 2px;
  min-height: 76px; padding: 13px 14px; text-align: left; cursor: pointer;
  background: #ffffff;
  color: var(--smp-ivory);
  border: 1px solid var(--smp-line); border-left: 3px solid var(--smp-brass);
  border-radius: 10px;
  box-shadow: 0 1px 3px rgba(15, 20, 26, 0.08);
  font: inherit;
}
.smp-tile:active { transform: translateY(1px); border-left-color: var(--smp-brass-hi); }
/* KEY-REQUEST-REDESIGN-20261028: the Keys tile carries the same flashing
   request count as the Keys menu entry — parked on the tile's corner. */
.smp-tile { position: relative; }
.smp-tile .header-alert-badge { position: absolute; top: 8px; right: 8px; margin-left: 0; }
.smp-tile-hero { grid-column: 1 / -1; border-left-color: var(--smp-brass); background: #faf6ea; }
.smp-tile-ico { font-size: 22px; line-height: 1; }
.smp-tile-label { font-size: calc(16px * var(--font-scale, 1)); font-weight: 700; letter-spacing: 0.01em; }
.smp-tile-sub { font-size: calc(12px * var(--font-scale, 1)); color: var(--smp-muted); }
.smp-home-foot { margin-top: 14px; color: var(--smp-muted); font-size: calc(12px * var(--font-scale, 1)); text-align: center; }

/* --- Forms (check-in + agreement) ---------------------------------------- */
.smp-section {
  margin: 18px 0 10px; font-family: var(--smp-serif); font-weight: 700; letter-spacing: 0.06em;
  color: var(--smp-brass-hi); font-size: calc(15px * var(--font-scale, 1));
  border-bottom: 1px solid var(--smp-line); padding-bottom: 6px;
}
.smp-field { display: block; margin: 0 0 12px; }
.smp-field > span { display: block; color: var(--smp-muted); font-size: calc(12.5px * var(--font-scale, 1)); margin-bottom: 5px; letter-spacing: 0.03em; }
.smp-field input, .smp-field textarea, .smp-field select {
  width: 100%; box-sizing: border-box;
  min-height: 48px; padding: 11px 12px;
  font-size: calc(16px * var(--font-scale, 1));
  color: var(--smp-ivory);
  background: #ffffff; border: 1px solid var(--smp-line); border-radius: 9px;
}
.smp-field textarea { min-height: 76px; resize: vertical; }
.smp-field input:focus, .smp-field textarea:focus { outline: 2px solid var(--smp-brass-dim); border-color: var(--smp-brass); }
.smp-grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
.smp-btn { min-height: 48px; padding: 10px 16px; font-size: calc(15px * var(--font-scale, 1)); }
.smp-btn-big { width: 100%; min-height: 54px; padding: 13px 16px; font-size: calc(16.5px * var(--font-scale, 1)); font-weight: 700; margin-top: 6px; }
.smp-vin-row { margin-bottom: 12px; }
.smp-msg {
  margin: 10px 0; padding: 10px 12px; border-radius: 9px;
  background: rgba(201, 165, 63, 0.1); border: 1px solid var(--smp-brass-dim);
  color: var(--smp-ivory); font-size: calc(14px * var(--font-scale, 1));
}
.smp-msg-err { background: rgba(207, 33, 21, 0.12); border-color: rgba(207, 33, 21, 0.55); }
.smp-hint { color: var(--smp-muted); font-size: calc(12.5px * var(--font-scale, 1)); line-height: 1.45; }
.smp-loading { padding: 26px 6px; color: var(--smp-muted); text-align: center; }

/* --- Lookup matches ------------------------------------------------------- */
.smp-match-box { margin: 12px 0 4px; display: flex; flex-direction: column; gap: 8px; }
.smp-match-head { color: var(--smp-brass-hi); font-size: calc(13px * var(--font-scale, 1)); letter-spacing: 0.04em; }
.smp-match {
  display: flex; flex-direction: column; gap: 1px; text-align: left; cursor: pointer;
  min-height: 52px; padding: 10px 12px; font: inherit;
  background: var(--smp-panel); color: var(--smp-ivory);
  border: 1px solid var(--smp-line); border-left: 3px solid var(--smp-brass); border-radius: 9px;
}
.smp-match-name { font-weight: 700; font-size: calc(15.5px * var(--font-scale, 1)); }
.smp-match-sub { color: var(--smp-muted); font-size: calc(12.5px * var(--font-scale, 1)); }

/* --- Check-in done --------------------------------------------------------- */
.smp-done-title { font-size: calc(19px * var(--font-scale, 1)); font-weight: 700; color: var(--smp-brass-hi); }
.smp-done-sub { color: var(--smp-muted); margin-top: 3px; font-size: calc(14px * var(--font-scale, 1)); }
.smp-done-row { display: flex; gap: 10px; margin-top: 18px; }
.smp-done-row .btn { flex: 1; min-height: 48px; }

/* --- Status lines ------------------------------------------------------------ */
.smp-state { display: inline-block; font-size: calc(13.5px * var(--font-scale, 1)); line-height: 1.45; }
.smp-state-sent { color: #2e7d32; }
.smp-state-draft { color: #7a5f1e; }
.smp-state-none { color: var(--smp-muted); }

/* --- Agreement ---------------------------------------------------------------- */
.smp-ag-head { text-align: center; margin-bottom: 12px; }
.smp-ag-title { font-family: var(--smp-serif); font-size: calc(19px * var(--font-scale, 1)); letter-spacing: 0.06em; color: var(--smp-brass-hi); }
.smp-ag-shop { font-weight: 700; margin-top: 6px; font-size: calc(13.5px * var(--font-scale, 1)); }
.smp-ag-addr { color: var(--smp-muted); font-size: calc(12px * var(--font-scale, 1)); margin-top: 2px; }
.smp-ag-job { margin-top: 8px; font-size: calc(14px * var(--font-scale, 1)); }
.smp-ag-text {
  background: #fbfaf7; border: 1px solid var(--smp-line); border-radius: 10px;
  padding: 14px 16px; max-height: 38dvh; overflow-y: auto;
  font-size: calc(14.5px * var(--font-scale, 1)); line-height: 1.55;
}
.smp-ag-text h3 { font-family: var(--smp-serif); color: var(--smp-brass-hi); letter-spacing: 0.05em; margin: 14px 0 6px; font-size: calc(15.5px * var(--font-scale, 1)); }
.smp-ag-text h3:first-child { margin-top: 0; }
.smp-ag-text p { margin: 0 0 8px; }
.smp-signed-box { margin-top: 14px; border: 1px solid var(--smp-brass-dim); border-radius: 10px; padding: 12px 14px; background: rgba(201, 165, 63, 0.07); }
.smp-signed-line { font-size: calc(15px * var(--font-scale, 1)); }
.smp-signed-sub { color: var(--smp-muted); font-size: calc(12.5px * var(--font-scale, 1)); margin-top: 2px; }
.smp-sig-img { display: block; margin-top: 10px; max-width: 100%; height: auto; background: #ffffff; border-radius: 6px; }
.smp-ag-sms { margin-top: 16px; border-top: 1px solid var(--smp-line); padding-top: 12px; display: flex; flex-direction: column; gap: 9px; align-items: flex-start; }
.smp-ag-sms-title { font-weight: 700; font-size: calc(15px * var(--font-scale, 1)); }
.smp-sign-block { margin-top: 16px; border-top: 1px solid var(--smp-line); padding-top: 12px; }
.smp-sign-title { font-weight: 700; font-size: calc(15.5px * var(--font-scale, 1)); margin-bottom: 10px; }
.smp-pad {
  display: block; width: 100%; height: auto; aspect-ratio: 680 / 220;
  background: #ffffff; border: 1px solid var(--smp-line); border-radius: 9px;
  touch-action: none; cursor: crosshair;
}
.smp-pad-row { display: flex; align-items: center; gap: 12px; margin: 8px 0 14px; }
.smp-pad-row .btn { min-height: 44px; }
.smp-radio-row { display: flex; gap: 18px; flex-wrap: wrap; margin: 4px 0 10px; font-size: calc(14.5px * var(--font-scale, 1)); }
.smp-radio-row input, .smp-check input { width: 20px; height: 20px; accent-color: var(--smp-brass); vertical-align: -4px; margin-right: 7px; }
.smp-check { display: block; margin: 0 0 10px; font-size: calc(14.5px * var(--font-scale, 1)); line-height: 1.4; }

/* --- Job-detail agreement row --------------------------------------------------- */
.smp-job-row {
  margin: 12px 0; padding: 12px 14px;
  border: 1px solid var(--smp-line, #d8dde3); border-left: 3px solid var(--smp-brass, #c9a53f);
  border-radius: 10px; background: rgba(201, 165, 63, 0.06);
}
.smp-job-line { font-size: calc(14.5px * var(--font-scale, 1)); }
.smp-job-sms { margin-top: 5px; }
.smp-job-btns { display: flex; gap: 10px; margin-top: 10px; flex-wrap: wrap; }
.smp-job-btns .btn { min-height: 46px; flex: 1; }

/* --- Menu entry: phone only ----------------------------------------------------- */
.smp-menu-item { display: none; }

/* --- Phone: full-screen app surfaces --------------------------------------------- */
@media (max-width: 820px) {
  .smp-menu-item { display: block; }
  .smp-overlay { padding: 0; align-items: stretch; }
  .smp-overlay .smp-box {
    width: 100%; max-width: none; height: 100dvh; max-height: none;
    border: none; border-radius: 0; padding: 16px 14px calc(20px + env(safe-area-inset-bottom));
  }
  .smp-tile-grid { grid-template-columns: 1fr 1fr; gap: 9px; }
  .smp-tile { min-height: 82px; }
  .smp-ag-text { max-height: 34dvh; }
}
@media (max-width: 400px) {
  .smp-grid2 { grid-template-columns: 1fr; }
  .smp-grid2 .smp-field { margin-bottom: 12px; }
}
