/* Porchlight Program app — TEST MODE build. Mobile-first, warm professional. */
:root{
  --bg:#faf6ef;
  --card:#ffffff;
  --ink:#2b2b28;
  --muted:#6f6a5e;
  --line:#e7dfd1;
  --teal:#1f5c5c;
  --teal-dark:#164444;
  --amber:#b45309;
  --amber-soft:#fef3e2;
  --green:#2f7d4f;
  --red:#b3261e;
  --blue:#1d4ed8;
  --test:#7c2d12;
  --test-bg:#fdeeda;
  --radius:14px;
  --tap:44px;
}
*{box-sizing:border-box;-webkit-tap-highlight-color:transparent}
html{font-size:16px}
body{
  margin:0;background:var(--bg);color:var(--ink);
  font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Helvetica,Arial,sans-serif;
  line-height:1.5;
  padding-bottom:calc(76px + env(safe-area-inset-bottom));
}
/* ---------- TEST MODE banner ---------- */
#test-banner{
  position:sticky;top:0;z-index:200;
  background:var(--test-bg);color:var(--test);
  border-bottom:2px solid var(--test);
  font-size:.78rem;font-weight:700;letter-spacing:.02em;
  padding:.55rem .9rem;display:flex;align-items:center;gap:.5rem;
}
.banner-dot{width:.6rem;height:.6rem;border-radius:50%;background:var(--test);flex:none;animation:pulse 2s infinite}
@keyframes pulse{50%{opacity:.4}}
/* ---------- layout ---------- */
#app{max-width:480px;margin:0 auto;padding:.9rem .9rem 1.5rem}
.view-head{display:flex;align-items:center;justify-content:space-between;gap:.6rem;margin:.2rem 0 .9rem}
.view-head h1{font-size:1.35rem;margin:0}
.view-head h2{font-size:1.1rem;margin:0}
.sub{color:var(--muted);font-size:.9rem;margin:.1rem 0 .8rem}
.card{
  background:var(--card);border:1px solid var(--line);border-radius:var(--radius);
  padding:.95rem;margin-bottom:.8rem;box-shadow:0 1px 3px rgba(60,50,30,.06);
}
.card h3{margin:.1rem 0 .5rem;font-size:1.02rem}
.row{display:flex;gap:.6rem;align-items:center;flex-wrap:wrap}
.grow{flex:1;min-width:0}
.muted{color:var(--muted)}
.small{font-size:.82rem}
.tiny{font-size:.74rem}
/* ---------- buttons / inputs ---------- */
button,.btn{
  min-height:var(--tap);min-width:var(--tap);
  border-radius:12px;border:1px solid var(--line);
  background:var(--card);color:var(--ink);
  font-size:1rem;font-weight:600;padding:.65rem 1rem;
  cursor:pointer;display:inline-flex;align-items:center;justify-content:center;gap:.45rem;
  text-decoration:none;touch-action:manipulation;
}
button:active,.btn:active{transform:scale(.98)}
.btn-primary{background:var(--teal);border-color:var(--teal-dark);color:#fff}
.btn-warm{background:var(--amber);border-color:#92400e;color:#fff}
.btn-danger{background:#fff;color:var(--red);border-color:var(--red)}
.btn-ghost{background:transparent}
.btn-block{width:100%}
.btn-sm{min-height:40px;padding:.45rem .7rem;font-size:.9rem}
.linklike{background:none;border:none;color:var(--teal);font-weight:600;padding:.4rem .2rem;min-height:var(--tap);font-size:1rem;text-decoration:underline;cursor:pointer}
input,select,textarea{
  width:100%;min-height:var(--tap);font-size:1rem;
  border:1px solid var(--line);border-radius:10px;padding:.6rem .75rem;
  background:#fff;color:var(--ink);font-family:inherit;
}
textarea{min-height:120px;resize:vertical;line-height:1.45}
label{display:block;font-weight:600;font-size:.9rem;margin:.7rem 0 .3rem}
label .hint{display:block;font-weight:400;color:var(--muted);font-size:.8rem}
fieldset{border:1px solid var(--line);border-radius:var(--radius);padding:.8rem;margin:0 0 .8rem;background:var(--card)}
legend{font-weight:700;padding:0 .4rem}
/* ---------- bottom nav ---------- */
#bottomnav{
  position:fixed;left:0;right:0;bottom:0;z-index:200;
  background:#fff;border-top:1px solid var(--line);
  display:flex;padding:.35rem .2rem calc(.35rem + env(safe-area-inset-bottom));
}
#bottomnav a{
  flex:1;display:flex;flex-direction:column;align-items:center;gap:2px;
  min-height:56px;justify-content:center;text-decoration:none;color:var(--muted);
  font-size:.7rem;font-weight:600;border-radius:10px;
}
#bottomnav a .ico{font-size:1.25rem;line-height:1}
#bottomnav a.active{color:var(--teal)}
.hidden{display:none!important}
/* ---------- lists ---------- */
.listitem{
  display:flex;gap:.7rem;align-items:center;width:100%;text-align:left;
  background:var(--card);border:1px solid var(--line);border-radius:var(--radius);
  padding:.8rem .9rem;margin-bottom:.6rem;min-height:60px;
}
.listitem .avatar{
  width:44px;height:44px;border-radius:50%;flex:none;
  background:var(--amber-soft);color:var(--amber);
  display:flex;align-items:center;justify-content:center;font-weight:800;font-size:1.1rem;
}
.badge{
  display:inline-block;font-size:.72rem;font-weight:700;letter-spacing:.03em;
  padding:.2rem .55rem;border-radius:999px;background:#efe9db;color:#5c5546;
  text-transform:uppercase;
}
.badge.ok{background:#e2f2e7;color:var(--green)}
.badge.warn{background:#fdeeda;color:var(--amber)}
.badge.bad{background:#fbe3e1;color:var(--red)}
.badge.info{background:#e3edf9;color:var(--blue)}
/* ---------- stages ---------- */
.stage{
  border:1px solid var(--line);border-radius:var(--radius);background:var(--card);
  margin-bottom:.6rem;overflow:hidden;
}
.stage-head{
  width:100%;min-height:60px;display:flex;gap:.7rem;align-items:center;
  background:none;border:none;padding:.8rem .9rem;text-align:left;cursor:pointer;
}
.stage-num{
  width:38px;height:38px;border-radius:50%;flex:none;
  background:#efe9db;color:#5c5546;font-weight:800;
  display:flex;align-items:center;justify-content:center;
}
.stage.current .stage-num{background:var(--teal);color:#fff}
.stage.done .stage-num{background:var(--green);color:#fff}
.stage-body{padding:0 .95rem .95rem;border-top:1px dashed var(--line)}
.talk-track{background:#f7f3ea;border-radius:10px;padding:.7rem .8rem;margin:.7rem 0;font-size:.93rem}
.exit-check{border:1px solid var(--line);border-radius:10px;padding:.6rem .7rem;margin:.5rem 0}
.exit-check.done{border-color:var(--green);background:#f4faf5}
.check-label{display:flex;gap:.6rem;align-items:flex-start;cursor:pointer;min-height:var(--tap)}
.check-label input{width:24px;height:24px;min-height:24px;flex:none;margin-top:2px;accent-color:var(--green)}
.check-actions{margin-top:.6rem;border-top:1px dashed var(--line);padding-top:.6rem}
.composer{display:grid;grid-template-columns:1fr 1fr 1fr;gap:.5rem;margin-top:.5rem}
/* ---------- modal ---------- */
#modal-root:empty{display:none}
.modal-veil{
  position:fixed;inset:0;background:rgba(30,25,15,.55);z-index:300;
  display:flex;align-items:flex-end;justify-content:center;
}
.modal{
  background:#fff;border-radius:18px 18px 0 0;width:100%;max-width:480px;
  max-height:88vh;overflow-y:auto;padding:1rem 1rem calc(1.2rem + env(safe-area-inset-bottom));
}
.modal h3{margin:.2rem 0 .6rem}
/* ---------- toast ---------- */
#toast-root{position:fixed;top:64px;left:0;right:0;z-index:400;display:flex;flex-direction:column;align-items:center;gap:.4rem;pointer-events:none}
.toast{
  background:#2b2b28;color:#fff;border-radius:10px;padding:.7rem 1rem;
  font-size:.92rem;max-width:92%;box-shadow:0 4px 14px rgba(0,0,0,.25);
}
.toast.err{background:var(--red)}
/* ---------- misc ---------- */
.divider{border:none;border-top:1px solid var(--line);margin:.9rem 0}
.progressbar{height:10px;background:#efe9db;border-radius:999px;overflow:hidden}
.progressbar>div{height:100%;background:var(--teal);border-radius:999px}
.script-tabs{display:flex;gap:.4rem;margin-bottom:.7rem}
.script-tabs button{flex:1}
.charcount{font-size:.8rem;color:var(--muted);text-align:right}
.charcount.over{color:var(--red);font-weight:700}
.sig-canvas{width:100%;height:180px;border:2px dashed var(--line);border-radius:10px;background:#fff;touch-action:none}
.doc-actions{display:flex;flex-wrap:wrap;gap:.45rem;margin-top:.5rem}
.doc-actions button,.doc-actions a{flex:1 1 44%}
.kv{display:grid;grid-template-columns:auto 1fr;gap:.25rem .8rem;font-size:.93rem}
.kv dt{color:var(--muted);font-weight:600}
.kv dd{margin:0}
.receipt{border:2px solid var(--teal);border-radius:var(--radius);padding:1rem;background:#fbfdfb}
.notice{background:var(--amber-soft);border:1px solid #f0d9ae;border-radius:10px;padding:.7rem .85rem;font-size:.9rem;margin:.6rem 0}
.agreement-label{background:#f1ece1;border:1px dashed #b9ac93;border-radius:10px;padding:.6rem .8rem;font-size:.85rem;margin:.6rem 0}
table.money{width:100%;border-collapse:collapse;font-size:.93rem}
table.money td,table.money th{padding:.45rem .2rem;border-bottom:1px solid var(--line);text-align:left}
table.money td.num,table.money th.num{text-align:right;font-variant-numeric:tabular-nums}
@media print{
  #test-banner,#bottomnav,.noprint{display:none!important}
  body{padding-bottom:0}
}
