/* offer-panel.css — the ONE discount / countdown-offer panel (window.PTOffer),
   shared by index.html (wizard) and dispatch.html (job card). OFFER-PANEL-
   SPEC.md v1. Brand tokens: --green-dark/--cream are defined identically on
   both host pages; the accent name differs (--green-accent on index.html,
   --gold on dispatch.html) so every accent use here falls back through both. */

.pto-overlay {
  position: fixed; inset: 0; z-index: 100050;
  background: rgba(44,55,44,0.55);
  display: flex; align-items: flex-start; justify-content: center;
  padding: 22px 14px; overflow-y: auto;
  font-family: 'DM Sans', 'Helvetica Neue', Helvetica, Arial, sans-serif;
}
.pto-card {
  width: 100%; max-width: 860px;
  background: var(--cream, #f5f0e8);
  border-radius: 14px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.35);
  overflow: hidden;
  margin: auto 0;
  display: flex; flex-direction: column;
  /* OFFER-PANEL-SPEC.md v2 §2.2 — sticky footer: the card itself caps its
     height (44 = the overlay's 22px top+bottom padding) so .pto-body, not the
     overlay, becomes the scroll container and .pto-hdr/.pto-ftr stay put.
     100vh fallback line first for old WebKit (no dvh support). */
  max-height: 100vh;
  max-height: calc(100vh - 44px);
  max-height: 100dvh;
  max-height: calc(100dvh - 44px);
}
.pto-hdr {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  background: var(--green-dark, #2c372c); color: var(--cream, #f5f0e8);
  padding: 16px 20px;
  flex: 0 0 auto;
}
.pto-hdr h3 {
  margin: 0; font-family: 'DM Serif Display', Georgia, serif;
  font-size: 20px; font-weight: 400; line-height: 1.2;
}
.pto-x {
  background: var(--green-accent, var(--gold, #b2b17d));
  color: var(--green-dark, #2c372c);
  border: none; border-radius: 8px; padding: 8px 16px;
  font-size: 13px; font-weight: 700; font-family: inherit; cursor: pointer;
  white-space: nowrap;
}
.pto-body {
  padding: 16px 20px 4px;
  flex: 1 1 auto; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch;
}

.pto-summary {
  font-size: 13.5px; font-weight: 600; line-height: 1.5;
  padding: 10px 13px; border-radius: 9px; margin-bottom: 14px;
  background: rgba(44,55,44,0.06); color: var(--green-dark, #2c372c);
}
.pto-summary.pto-summary-needed {
  background: rgba(178,177,125,0.22);
  color: #7a5b00;
}
.pto-summary .pto-summary-needed-label { font-weight: 700; }

.pto-grid { display: grid; grid-template-columns: 1fr; gap: 20px; }
@media (min-width: 900px) {
  .pto-grid { grid-template-columns: minmax(0,1fr) 280px; align-items: start; }
  .pto-preview-col { position: sticky; top: 8px; }
}

.pto-form { display: flex; flex-direction: column; gap: 16px; min-width: 0; }

/* OFFER-PANEL-SPEC.md v5 §5.2/§5.3 — one-tap presets, at the top of the
   form, above section 1. The update button is hidden via the `hidden`
   attribute (handled panel-wide at the [hidden] rule below) and carries no
   display rule of its own. */
.pto-presets {
  display: flex; flex-direction: column; gap: 6px;
  padding: 10px 12px; background: var(--cream, #f5f0e8);
  border: 1px solid rgba(44,55,44,0.12); border-radius: 12px;
}
.pto-presets-label {
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 1.2px;
  color: var(--green-dark, #2c372c); opacity: .7;
}
.pto-preset-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.pto-btn-sm { padding: 6px 12px; font-size: 12.5px; }

.pto-sec {
  border: 1px solid rgba(44,55,44,0.14);
  border-radius: 10px;
  padding: 12px 14px 14px;
  background: rgba(255,255,255,0.5);
}
.pto-sec-hdr {
  display: flex; align-items: center; gap: 8px; margin-bottom: 10px;
  font-size: 12.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 1px;
  color: var(--green-dark, #2c372c);
}
.pto-sec-num {
  display: inline-flex; align-items: center; justify-content: center;
  width: 19px; height: 19px; border-radius: 50%;
  background: var(--green-dark, #2c372c); color: var(--cream, #f5f0e8);
  font-size: 11px; font-weight: 700; flex-shrink: 0;
}
.pto-sec-title { flex: 1; }
.pto-badge {
  font-size: 10px; font-weight: 700; text-transform: none; letter-spacing: 0.3px;
  padding: 2px 8px; border-radius: 999px;
}
.pto-badge.ok { background: rgba(44,120,60,0.14); color: #1f6b2f; }
.pto-badge.needed { background: rgba(178,177,125,0.28); color: #7a5b00; }

.pto-toggle {
  display: flex; align-items: center; gap: 6px; margin-left: auto;
  font-size: 11.5px; text-transform: none; letter-spacing: 0; font-weight: 600;
  color: var(--green-dark, #2c372c); cursor: pointer;
}
.pto-toggle input { accent-color: var(--green-accent, var(--gold, #b2b17d)); width: 15px; height: 15px; cursor: pointer; }

.pto-seg { display: flex; gap: 7px; margin-bottom: 12px; }
.pto-seg button {
  flex: 1; padding: 8px 6px; border: 1px solid rgba(44,55,44,0.28);
  border-radius: 8px; background: #fff; font-family: inherit; font-size: 13px;
  cursor: pointer; color: var(--green-dark, #2c372c); font-weight: 500;
}
.pto-seg button.active {
  background: var(--green-dark, #2c372c); color: var(--cream, #f5f0e8);
  border-color: var(--green-dark, #2c372c); font-weight: 700;
}

.pto-row { display: flex; gap: 12px; flex-wrap: wrap; }
.pto-field { flex: 1; min-width: 140px; display: flex; flex-direction: column; gap: 4px; }
.pto-field label {
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.8px;
  color: var(--green-dark, #2c372c); opacity: 0.65;
}
.pto-amt-wrap { position: relative; }
.pto-amt-wrap .pto-adorn {
  position: absolute; left: 11px; top: 50%; transform: translateY(-50%);
  font-size: 14px; color: var(--green-dark, #2c372c); opacity: 0.55; pointer-events: none;
}
/* v5.6 (owner screenshot 2026-09-17: "$00" — the $ sat on the first digit):
   the generic `.pto-field input[type="number"]` rule below (0,2,1) resets
   padding to 11px and outranks `.pto-amt-wrap input` (0,1,1). Match its
   specificity and then some, so the adornment always has its 28px gutter. */
.pto-field .pto-amt-wrap input[type="number"], .pto-amt-wrap input { padding-left: 28px; }

input[type="text"].pto-input, input[type="number"], input[type="date"], textarea.pto-input,
.pto-field input[type="text"], .pto-field input[type="number"], .pto-field input[type="date"],
.pto-sec textarea {
  width: 100%; box-sizing: border-box;
  padding: 9px 11px; border: 1px solid rgba(44,55,44,0.25); border-radius: 8px;
  font-family: inherit; font-size: 14px; background: #fff; color: var(--green-dark, #2c372c);
  appearance: none; -webkit-appearance: none;
}
.pto-sec textarea { resize: vertical; line-height: 1.5; }
.pto-hint { font-size: 12px; color: var(--green-dark, #2c372c); opacity: 0.65; min-height: 15px; }

.pto-inclgst-row {
  display: flex; align-items: center; gap: 7px; font-size: 13px; cursor: pointer;
  margin-top: 4px; color: var(--green-dark, #2c372c);
}
.pto-inclgst-row input { accent-color: var(--green-accent, var(--gold, #b2b17d)); }

.pto-chips { display: flex; gap: 7px; flex-wrap: wrap; margin-bottom: 10px; }
.pto-chip {
  padding: 6px 13px; border: 1px solid rgba(44,55,44,0.28); border-radius: 999px;
  background: #fff; font-size: 12.5px; cursor: pointer; font-family: inherit;
  color: var(--green-dark, #2c372c);
}
.pto-chip.active {
  background: var(--green-accent, var(--gold, #b2b17d)); border-color: transparent;
  color: var(--green-dark, #2c372c); font-weight: 700;
}
.pto-muted { font-size: 11.5px; color: var(--green-dark, #2c372c); opacity: 0.6; margin-top: 6px; }
.pto-warn {
  font-size: 12px; font-weight: 600; color: #7a5b00; background: rgba(178,177,125,0.22);
  border-radius: 7px; padding: 7px 10px; margin-top: 8px;
}
.pto-warn ul { margin: 4px 0 4px 18px; padding: 0; font-weight: 500; }

.pto-pills { display: flex; gap: 7px; flex-wrap: wrap; margin-bottom: 10px; }
.pto-pill {
  position: relative; padding: 6px 26px 6px 13px; border: 1px solid rgba(44,55,44,0.28);
  border-radius: 999px; background: #fff; font-size: 12.5px; cursor: pointer;
  font-family: inherit; color: var(--green-dark, #2c372c);
}
.pto-pill.selected {
  background: var(--green-dark, #2c372c); color: var(--cream, #f5f0e8); border-color: var(--green-dark, #2c372c);
}
.pto-pill-x {
  position: absolute; right: 5px; top: 50%; transform: translateY(-50%);
  background: none; border: none; font-size: 13px; line-height: 1; cursor: pointer;
  color: inherit; opacity: 0.6; padding: 2px 4px;
}
.pto-pill-x:hover { opacity: 1; }
.pto-pill-empty { font-size: 12px; opacity: 0.55; padding: 6px 0; }

.pto-tpl-link {
  display: inline-block; font-size: 12.5px; color: var(--green-dark, #2c372c);
  text-decoration: underline; cursor: pointer; margin-top: 4px;
}
/* The panel toggles visibility with the `hidden` attribute (el.hidden = …).
   An author `display:flex` on a class BEATS the UA's [hidden]{display:none},
   so every flex/grid box in here (the template-save rows, the footer totals
   strip) rendered even while hidden — found by a headless-Chrome render on
   2026-09-16, never by the stub-DOM suite (which has no cascade). One rule,
   panel-wide, so the next flex box cannot regress it. */
.pto-overlay [hidden] { display: none !important; }
.pto-tpl-save { display: flex; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.pto-tpl-save input { flex: 1; min-width: 140px; }
.pto-tpl-save button {
  padding: 8px 14px; border-radius: 8px; border: 1px solid var(--green-dark, #2c372c);
  background: var(--green-dark, #2c372c); color: var(--cream, #f5f0e8);
  font-size: 12.5px; font-weight: 700; cursor: pointer; font-family: inherit; white-space: nowrap;
}

.pto-preview-col { display: flex; flex-direction: column; gap: 8px; padding-bottom: 10px; }
.pto-preview-label {
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 1px;
  color: var(--green-dark, #2c372c); opacity: 0.6;
}
.pto-preview-frame {
  border: 1px solid rgba(44,55,44,0.18); border-radius: 12px; overflow: hidden;
  background: rgba(44,55,44,0.05); padding: 14px;
  display: flex; justify-content: center;
}
.pto-preview-scale { transform: scale(0.72); transform-origin: top center; width: 138.9%; margin-bottom: -12%; }
.pto-preview-full {
  display: inline-block; font-size: 12.5px; color: var(--green-dark, #2c372c);
  text-decoration: underline; cursor: pointer; text-align: center;
}
.pto-ftr {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 14px 20px 18px; border-top: 1px solid rgba(44,55,44,0.12);
  flex: 0 0 auto;
}
.pto-ftr-spacer { flex: 1; }
/* OFFER-PANEL-SPEC.md v2 §2.2 — the totals element MOVED here from the
   preview column (rule 0.5, one element not a copy) so the commit button and
   the money are visible together without scrolling. `order:-2` puts it above
   .pto-err (`order:-1`, unchanged — an error still sits between the totals
   and the buttons) and above the buttons themselves. */
.pto-ftr-totals { width: 100%; order: -2; display: flex; flex-direction: column; gap: 2px; font-size: 13px; }
.pto-ftr-totals .pto-pt-row { display: flex; justify-content: space-between; gap: 8px; font-weight: 600; }
.pto-err {
  font-size: 12.5px; font-weight: 600; color: #a33; width: 100%; order: -1;
}
.pto-btn {
  border: none; border-radius: 9px; padding: 11px 20px; font-size: 14px; font-weight: 700;
  cursor: pointer; font-family: inherit;
}
.pto-btn-primary { background: var(--green-accent, var(--gold, #b2b17d)); color: var(--green-dark, #2c372c); }
.pto-btn-primary:disabled { opacity: 0.45; cursor: not-allowed; }
.pto-btn-primary-hint { font-size: 11.5px; opacity: 0.75; font-weight: 600; margin-top: -4px; }
.pto-btn-outline {
  background: none; color: var(--green-dark, #2c372c); border: 1px solid rgba(44,55,44,0.35);
}
.pto-btn-ghost { background: none; color: var(--green-dark, #2c372c); opacity: 0.75; }

/* OFFER-PANEL-SPEC.md v3.2 §3.12.2 — "Preview email": the assembled email,
   shown inside the send sheet (never a new tab — the iPad rule). [hidden] is
   handled panel-wide at :188, so the wrap itself carries no display rule. */
.pto-email-preview { margin-top: 10px; border: 1px solid rgba(44,55,44,0.18); border-radius: 10px; overflow: hidden; background: #fff; }
.pto-email-preview-subject { font-size: 12px; font-weight: 600; padding: 7px 10px; background: var(--cream, #f5f0e8); color: var(--green-dark, #2c372c); border-bottom: 1px solid rgba(44,55,44,0.12); }
.pto-email-preview-frame { display: block; width: 100%; height: 560px; border: 0; background: #fff; }

@media (max-width: 640px) {
  .pto-overlay { padding: 0; align-items: stretch; }
  .pto-card {
    max-width: none; border-radius: 0; margin: 0;
    max-height: 100vh; min-height: 100vh;
    max-height: 100dvh; min-height: 100dvh;
  }
  .pto-email-preview-frame { height: 440px; }
}
