/* ============================================================
   Powermieter — Onboarding components & screens
   Class convention preserved from the original design (pm-*).
   ============================================================ */

/* ---- Shell ---------------------------------------------------- */
.pm-embed { min-height: 100dvh; display: flex; flex-direction: column; }

.pm-topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 14px clamp(16px, 4vw, 40px);
  background: color-mix(in srgb, var(--surface) 86%, transparent);
  backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--border);
}
.pm-topbar-help {
  display: flex; align-items: center; gap: 10px;
  font-size: 13px; color: var(--text-2); font-weight: 500;
}
.pm-topbar-help .pm-sep { width: 1px; height: 18px; background: var(--border); }
.pm-link { color: var(--accent); text-decoration: none; border-bottom: 1px solid transparent; }
.pm-link:hover { border-bottom-color: currentColor; }
@media (max-width: 640px) { .pm-topbar-help .pm-hide-sm { display: none; } }

/* ---- Logo ----------------------------------------------------- */
.pm-logo { display: inline-flex; align-items: center; gap: 10px; font-family: var(--font-display); font-weight: 800; letter-spacing: -.02em; }
.pm-logo-mark { display: grid; place-items: center; border-radius: 11px; background: var(--navy-900); color: var(--accent-400); border: 1.5px solid var(--accent-700); }
.pm-logo-word { font-size: 19px; color: var(--text); }
.pm-logo-word b { color: var(--accent); font-weight: 800; }

/* ---- Step nav ------------------------------------------------- */
.pm-stepbar {
  position: sticky; top: 57px; z-index: 15;
  background: color-mix(in srgb, var(--bg) 80%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}
.pm-stepbar-inner { max-width: 760px; margin: 0 auto; padding: 14px clamp(16px, 4vw, 40px); }
.pm-procnav { display: flex; align-items: center; gap: 0; }
.pm-procnav-step { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; }
.pm-procnav-dot {
  flex: none; width: 30px; height: 30px; border-radius: var(--radius-pill);
  display: grid; place-items: center; font-size: 13px; font-weight: 700;
  background: var(--surface-2); color: var(--text-3);
  border: 1.5px solid var(--border); transition: all .35s var(--ease);
}
.pm-procnav-label { font-size: 12.5px; font-weight: 600; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pm-procnav-bar { flex: 1; height: 2px; background: var(--border); margin: 0 8px; border-radius: 2px; overflow: hidden; position: relative; }
.pm-procnav-bar::after { content:""; position:absolute; inset:0; width:0; background: var(--accent); transition: width .45s var(--ease); }
.pm-procnav-step.is-done .pm-procnav-bar::after { width: 100%; }
.pm-procnav-step.is-active .pm-procnav-dot,
.pm-procnav-step.is-done .pm-procnav-dot { background: var(--accent); color: var(--btn-primary-ink); border-color: var(--accent); }
.pm-procnav-step.is-active .pm-procnav-label,
.pm-procnav-step.is-done .pm-procnav-label { color: var(--text); }
.pm-procnav-step.is-clickable { cursor: pointer; }
@media (max-width: 640px) { .pm-procnav-label { display: none; } .pm-procnav-step { gap: 0; } }

/* ---- Stage / pages -------------------------------------------- */
.pm-stage { flex: 1; }
.pm-page { max-width: 720px; margin: 0 auto; padding: clamp(22px, 5vw, 48px) clamp(16px, 4vw, 40px) 120px; }
.pm-anim { animation: pm-rise .5s var(--ease) both; }
@keyframes pm-rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

.pm-eyebrow { font-family: var(--font-mono); font-size: 12px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--accent); }
.pm-h1 { font-family: var(--font-display); font-size: clamp(26px, 5vw, 36px); line-height: 1.08; letter-spacing: -.02em; margin: 10px 0 8px; font-weight: 800; }
.pm-lead { font-size: 16px; line-height: 1.55; color: var(--text-2); margin: 0 0 24px; max-width: 56ch; }

/* ---- Cards ---------------------------------------------------- */
.pm-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-md); }
.pm-card-pad { padding: clamp(18px, 3vw, 26px); }
.pm-card + .pm-card { margin-top: 16px; }
.pm-card-head { display: flex; align-items: center; gap: 12px; margin-bottom: 4px; }
.pm-card-title { font-family: var(--font-display); font-weight: 700; font-size: 17px; letter-spacing: -.01em; }
.pm-card-sub { font-size: 13.5px; color: var(--text-3); margin-top: 2px; }

/* Prefilled "we already know this" panel */
.pm-prefill { background: var(--accent-tint); border: 1px solid var(--accent-tint-border); border-radius: var(--radius-md); padding: 16px 18px; }
.pm-prefill-row { display: flex; justify-content: space-between; gap: 16px; padding: 7px 0; font-size: 14px; border-bottom: 1px dashed color-mix(in srgb, var(--accent-tint-border) 70%, transparent); }
.pm-prefill-row:last-child { border-bottom: 0; }
.pm-prefill-row dt { color: var(--text-2); }
.pm-prefill-row dd { margin: 0; font-weight: 600; text-align: right; font-variant-numeric: tabular-nums; }
.pm-prefill-tag { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; color: var(--accent); margin-bottom: 10px; }

/* ---- KPIs / savings ------------------------------------------- */
.pm-kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin: 4px 0 24px; }
.pm-kpi { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 16px; text-align: center; box-shadow: var(--shadow-sm); }
.pm-kpi-num { font-family: var(--font-display); font-size: clamp(22px, 4vw, 28px); font-weight: 800; letter-spacing: -.02em; color: var(--accent); }
.pm-kpi-lbl { font-size: 12px; color: var(--text-3); margin-top: 2px; }
@media (max-width: 520px){ .pm-kpis { grid-template-columns: 1fr; } }

/* ---- Forms ---------------------------------------------------- */
.pm-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.pm-grid .pm-col-2 { grid-column: 1 / -1; }
@media (max-width: 560px){ .pm-grid { grid-template-columns: 1fr; } .pm-grid .pm-col-2 { grid-column: auto; } }

.pm-field { display: flex; flex-direction: column; gap: 6px; }
.pm-label { font-size: 13px; font-weight: 600; color: var(--text-2); }
.pm-label .pm-opt { color: var(--text-3); font-weight: 500; }
.pm-input, .pm-select {
  width: 100%; font: inherit; font-size: 15px; color: var(--text);
  background: var(--surface); border: 1.5px solid var(--border);
  border-radius: var(--radius-sm); padding: var(--pad-y) 14px;
  transition: border-color .2s var(--ease), box-shadow .2s var(--ease);
}
.pm-input::placeholder { color: var(--text-3); }
.pm-input:focus, .pm-select:focus { outline: none; border-color: var(--ring); box-shadow: 0 0 0 4px color-mix(in srgb, var(--ring) 22%, transparent); }
.pm-input.is-error, .pm-select.is-error { border-color: #E5484D; }
.pm-err { font-size: 12.5px; color: #E5484D; }
.pm-hint { font-size: 12.5px; color: var(--text-3); }

/* Checkbox / consent */
.pm-check { display: flex; gap: 12px; align-items: flex-start; padding: 12px 0; cursor: pointer; }
.pm-check input { position: absolute; opacity: 0; width: 0; height: 0; }
.pm-check-box { flex: none; width: 22px; height: 22px; border-radius: 7px; border: 1.5px solid var(--border-strong); background: var(--surface); display: grid; place-items: center; transition: all .18s var(--ease); margin-top: 1px; }
.pm-check-box svg { opacity: 0; transform: scale(.6); transition: all .18s var(--ease); color: #fff; }
.pm-check input:checked + .pm-check-box { background: var(--accent); border-color: var(--accent); }
.pm-check input:checked + .pm-check-box svg { opacity: 1; transform: none; }
.pm-check input:focus-visible + .pm-check-box { box-shadow: 0 0 0 4px color-mix(in srgb, var(--ring) 22%, transparent); }
.pm-check-text { font-size: 13.5px; line-height: 1.5; color: var(--text-2); }
.pm-check.is-error .pm-check-box { border-color: #E5484D; }

/* ---- Buttons -------------------------------------------------- */
.pm-btn { display: inline-flex; align-items: center; justify-content: center; gap: 9px; font: inherit; font-weight: 700; font-size: 15px; cursor: pointer; border: 1.5px solid transparent; border-radius: var(--radius-pill); padding: 13px 24px; transition: transform .12s var(--ease), background .2s var(--ease), box-shadow .2s var(--ease); }
.pm-btn:active { transform: translateY(1px) scale(.99); }
.pm-btn[disabled] { opacity: .5; cursor: not-allowed; }
.pm-btn-primary { background: var(--btn-primary-bg); color: var(--btn-primary-ink); box-shadow: var(--shadow-md); }
.pm-btn-primary:hover:not([disabled]) { background: var(--btn-primary-bg-hover); }
.pm-btn-ghost { background: transparent; color: var(--text-2); border-color: var(--border-strong); }
.pm-btn-ghost:hover { color: var(--text); border-color: var(--text-3); }
.pm-btn-lg { padding: 16px 30px; font-size: 16px; }
.pm-btn-block { width: 100%; }

/* Sticky bottom CTA */
.pm-bottomcta { position: sticky; bottom: 0; z-index: 18; display: flex; gap: 12px; align-items: center; justify-content: space-between; padding: 14px clamp(16px, 4vw, 40px); background: color-mix(in srgb, var(--surface) 88%, transparent); backdrop-filter: blur(10px); border-top: 1px solid var(--border); }
.pm-bottomcta .pm-cta-meta { font-size: 12.5px; color: var(--text-3); }

/* ---- Trust / badges ------------------------------------------- */
.pm-badge { display: inline-flex; align-items: center; gap: 7px; font-size: 12.5px; font-weight: 600; padding: 6px 12px; border-radius: var(--radius-pill); background: var(--positive-tint); color: var(--positive); border: 1px solid color-mix(in srgb, var(--positive) 30%, transparent); }
.pm-trustrow { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }
.pm-trust { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-2); }
.pm-trust svg { color: var(--positive); flex: none; }

/* ---- Signature ------------------------------------------------ */
.pm-sign { border: 1.5px dashed var(--border-strong); border-radius: var(--radius-md); background: var(--surface-2); position: relative; overflow: hidden; }
.pm-sign canvas { display: block; width: 100%; height: 180px; touch-action: none; cursor: crosshair; }
.pm-sign-base { position: absolute; left: 18px; right: 18px; bottom: 38px; height: 1px; background: var(--border-strong); pointer-events: none; }
.pm-sign-x { position: absolute; left: 18px; bottom: 30px; color: var(--text-3); font-size: 18px; pointer-events: none; }
.pm-sign-ph { position: absolute; inset: 0; display: grid; place-items: center; color: var(--text-3); font-size: 14px; pointer-events: none; transition: opacity .2s; }
.pm-sign.is-signed .pm-sign-ph { opacity: 0; }
.pm-sign-actions { display: flex; justify-content: space-between; align-items: center; margin-top: 8px; font-size: 13px; color: var(--text-3); }
.pm-sign-clear { background: none; border: 0; color: var(--accent); font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; display: inline-flex; align-items: center; gap: 5px; }
.pm-sign.is-error { border-color: #E5484D; }

/* ---- Meter photo ---------------------------------------------- */
.pm-photo-btn { width: 100%; display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 22px; border: 1.5px dashed var(--border-strong); border-radius: var(--radius-md); background: var(--surface-2); color: var(--text-2); font: inherit; font-weight: 600; cursor: pointer; transition: all .18s var(--ease); }
.pm-photo-btn:hover { border-color: var(--accent); color: var(--text); }
.pm-photo-btn svg { color: var(--accent); }
.pm-photo-sub { font-size: 12px; font-weight: 500; color: var(--text-3); }
.pm-photo.is-error .pm-photo-btn { border-color: #E5484D; }
.pm-photo-thumb { width: 100%; max-height: 240px; object-fit: contain; border-radius: var(--radius-md); border: 1px solid var(--border); background: var(--surface-2); }
.pm-photo-actions { display: flex; justify-content: space-between; align-items: center; margin-top: 8px; }

/* ---- Success -------------------------------------------------- */
.pm-success { text-align: center; padding: clamp(20px, 6vw, 50px) 0; }
.pm-success-ring { width: 92px; height: 92px; margin: 0 auto 22px; border-radius: var(--radius-pill); display: grid; place-items: center; background: var(--positive-tint); border: 2px solid var(--positive); color: var(--positive); animation: pm-pop .5s var(--ease) both; }
@keyframes pm-pop { from { transform: scale(.6); opacity: 0; } to { transform: none; opacity: 1; } }
.pm-success-steps { text-align: left; max-width: 460px; margin: 26px auto 0; display: grid; gap: 12px; }
.pm-success-step { display: flex; gap: 12px; align-items: flex-start; font-size: 14.5px; color: var(--text-2); }
.pm-success-step .pm-num { flex: none; width: 26px; height: 26px; border-radius: var(--radius-pill); background: var(--surface-2); border: 1px solid var(--border); display: grid; place-items: center; font-size: 12px; font-weight: 700; color: var(--text); }

/* ---- Rep / kiosk picker --------------------------------------- */
.pm-repbar { display: flex; align-items: center; gap: 10px; padding: 8px 14px; background: var(--navy-900); color: var(--text-on-navy); font-size: 13px; font-weight: 600; }
.pm-repbar .pm-repbar-tag { background: var(--accent-400); color: #04222A; padding: 2px 9px; border-radius: var(--radius-pill); font-size: 11px; letter-spacing: .04em; text-transform: uppercase; }
.pm-unit-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; margin-top: 16px; }
.pm-unit { text-align: left; background: var(--surface); border: 1.5px solid var(--border); border-radius: var(--radius-md); padding: 14px 16px; cursor: pointer; transition: all .18s var(--ease); }
.pm-unit:hover { border-color: var(--accent); transform: translateY(-2px); box-shadow: var(--shadow-md); }
.pm-unit.is-signed { opacity: .55; }
.pm-unit-we { font-family: var(--font-display); font-weight: 700; font-size: 16px; }
.pm-unit-meta { font-size: 12.5px; color: var(--text-3); margin-top: 2px; }
.pm-unit-state { font-size: 11.5px; font-weight: 600; margin-top: 8px; display: inline-flex; align-items: center; gap: 5px; }
.pm-unit-state.open { color: var(--accent); }
.pm-unit-state.done { color: var(--positive); }

/* ---- Misc ----------------------------------------------------- */
.pm-divider { height: 1px; background: var(--border); margin: 20px 0; border: 0; }
.pm-note { display: flex; gap: 10px; font-size: 13px; color: var(--text-2); background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 13px 15px; }
.pm-note svg { flex: none; color: var(--accent); margin-top: 1px; }
.pm-spin { width: 16px; height: 16px; border-radius: 50%; border: 2px solid color-mix(in srgb, currentColor 30%, transparent); border-top-color: currentColor; animation: pm-rot .7s linear infinite; }
@keyframes pm-rot { to { transform: rotate(360deg); } }
.pm-theme-toggle { background: none; border: 1px solid var(--border); border-radius: var(--radius-pill); width: 34px; height: 34px; display: grid; place-items: center; cursor: pointer; color: var(--text-2); }
.pm-theme-toggle:hover { color: var(--text); border-color: var(--text-3); }

/* ---- Contract modal ------------------------------------------- */
.pm-modal-overlay { position: fixed; inset: 0; z-index: 60; background: #0a1220aa; backdrop-filter: blur(4px); display: flex; align-items: center; justify-content: center; padding: clamp(10px, 3vw, 36px); animation: pm-rise .2s var(--ease) both; }
.pm-modal { background: var(--surface); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); width: min(860px, 100%); height: min(88vh, 1000px); display: flex; flex-direction: column; overflow: hidden; }
.pm-modal-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px; border-bottom: 1px solid var(--border); font-weight: 700; font-family: var(--font-display); }
.pm-modal-x { background: none; border: 0; font-size: 26px; line-height: 1; color: var(--text-3); cursor: pointer; width: 36px; height: 36px; border-radius: var(--radius-pill); }
.pm-modal-x:hover { background: var(--surface-2); color: var(--text); }
.pm-modal-frame { flex: 1; width: 100%; border: 0; background: #fff; }
.pm-modal-loading { flex: 1; display: flex; align-items: center; justify-content: center; gap: 10px; color: var(--text-3); }
