/* ════════════════════════════════════════════════════════════════
   Waypoint OS mobile app (m-app.html) — theme.
   MATCHES THE CANONICAL CRM (crm.html): light grey ground, white cards,
   navy ink, gold accents, a navy-deep sticky top bar. DM Sans for the UI,
   Playfair Display for big numbers and titles. The colours come from
   css/waypoint-palette.css (loaded before this file in m-app.html) so the
   phone and the CRM read as one product and move together.

   The class names are unchanged from the earlier dark theme on purpose: the
   views in js/app/ emit them, so the look changes here without touching
   every view. The old HUD corner brackets and scanline are hidden rather than
   removed from the markup for the same reason.
   ════════════════════════════════════════════════════════════════ */
:root{
  --navy:var(--wp-brand-navy,#1a2a44); --navy-deep:var(--wp-brand-navy-deep,#0f1c30);
  --bg:var(--wp-light-canvas,#f0f2f5);
  --surface:var(--wp-light-panel,#ffffff); --surface-2:var(--wp-light-panel,#ffffff);
  --gold:var(--wp-gold-fill,#b89548); --gold-pale:rgba(184,149,72,.16);
  /* Gold as WORDS on a light ground. --gold-lt is kept as a name because views
     reference it, but on white it has to be the dark gold to stay legible. */
  --gold-lt:#8a6a24; --gold-on-dark:var(--wp-gold-text,#d4af6a);
  --green:var(--wp-light-good,#157347); --green-bg:#e7f4ed;
  --red:var(--wp-light-bad,#b3261e); --red-bg:#fdecea;
  --amber:var(--wp-light-warn,#8a6512); --amber-bg:#fdf4e0;
  /* --bright is "the main text colour" in the views, so on light it is navy. */
  --bright:var(--wp-light-ink,#1a2a44); --muted:var(--wp-light-ink-muted,#6b7688); --faint:#8a94a6;
  --line:var(--wp-light-line,#e3e8ef); --line-gold:rgba(184,149,72,.45);
  --safe-top:env(safe-area-inset-top,0px); --safe-bottom:env(safe-area-inset-bottom,0px);
  color-scheme:light;
}
*{margin:0;padding:0;box-sizing:border-box;-webkit-tap-highlight-color:transparent;}
body{
  font-family:'DM Sans',system-ui,-apple-system,sans-serif; color:var(--bright);
  background:var(--bg); min-height:100vh; overflow-x:hidden; -webkit-text-size-adjust:100%;
}
a{color:inherit;}
.mono{font-family:'DM Sans',system-ui,sans-serif;}
.serif{font-family:'Playfair Display',serif;}
.eyebrow{text-transform:uppercase;letter-spacing:.08em;font-size:11px;color:var(--gold-lt);font-weight:800;}
.muted{color:var(--muted);} .faint{color:var(--faint);}

/* ── HEADER (same navy-deep bar as the CRM) ── */
.hdr{position:sticky;top:0;z-index:50;background:var(--navy-deep);padding:calc(var(--safe-top) + 10px) 14px 10px;display:flex;align-items:center;gap:10px;color:#fff;}
.brand{display:flex;align-items:center;gap:9px;}
.brand img{width:26px;height:26px;border-radius:6px;}
.brand .nm{font-family:'Playfair Display',serif;font-weight:800;font-size:17px;color:#fff;}
.live{display:flex;align-items:center;gap:6px;margin-left:auto;font-size:11px;font-weight:700;letter-spacing:.04em;color:rgba(255,255,255,.72);text-transform:uppercase;}
.dot{width:7px;height:7px;border-radius:50%;background:#27ae60;}
.dot.off{background:var(--faint);}
.dot.pulse{animation:pulse 2.4s infinite;}
@keyframes pulse{0%{box-shadow:0 0 0 0 rgba(39,174,96,.5);}70%{box-shadow:0 0 0 7px rgba(39,174,96,0);}100%{box-shadow:0 0 0 0 rgba(39,174,96,0);}}
.iconbtn{background:rgba(255,255,255,.08);border:0;color:rgba(255,255,255,.8);width:34px;height:34px;border-radius:9px;display:flex;align-items:center;justify-content:center;cursor:pointer;font-family:inherit;flex-shrink:0;text-decoration:none;}
.iconbtn svg{display:block;}

/* ── MODE TOGGLE (Realtor / Broker) ── */
.modebar{display:flex;justify-content:center;padding:12px 14px 2px;}
.seg{display:inline-flex;background:var(--surface);border:1px solid var(--line);border-radius:10px;padding:3px;gap:2px;}
.seg button{white-space:nowrap;font-family:inherit;font-size:13px;font-weight:700;border:none;background:transparent;color:var(--muted);padding:8px 18px;border-radius:8px;cursor:pointer;transition:.15s;}
.seg button.on{background:var(--navy);color:#fff;}

/* ── SCROLL / VIEW / TRANSITIONS ── */
.scroll{padding:10px 14px calc(var(--safe-bottom) + 86px);max-width:720px;margin:0 auto;}
/* No will-change on #view: it would create a stacking context, sinking the
   position:fixed bottom-sheets (z 120) below the fixed nav (z 50) so the nav
   covers the sheet's primary button. The .enter animation works without it. */
@media (prefers-reduced-motion:no-preference){
  .enter{animation:enter .2s ease-out;}
  @keyframes enter{from{opacity:0;transform:translateY(6px);}to{opacity:1;transform:none;}}
}

/* ── PANELS ── */
.panel{position:relative;background:var(--surface);border:1px solid var(--line);border-radius:14px;padding:16px;margin-bottom:12px;}
.panel.gold{border-color:var(--line-gold);}
.panel.flush{padding:0;overflow:hidden;}
/* The old HUD brackets and scanline: still emitted by hud(), no longer drawn. */
.hud .c,.scanline{display:none;}

/* ── HERO + METRICS ── */
.hero-ey{margin-bottom:8px;}
.hero-big{font-family:'Playfair Display',serif;font-weight:800;font-size:40px;line-height:1;color:var(--navy);}
.hero-sub{font-size:11px;font-weight:700;letter-spacing:.04em;text-transform:uppercase;color:var(--muted);margin-top:8px;}
.metrics{display:grid;grid-template-columns:1fr 1fr;gap:10px;margin-bottom:12px;}
.metric{position:relative;background:var(--surface);border:1px solid var(--line);border-radius:12px;padding:12px 14px;}
.metric .v{font-weight:800;font-size:24px;line-height:1.1;color:var(--bright);}
.metric .v.gold{color:var(--gold-lt);} .metric .v.green{color:var(--green);}
.metric .l{font-size:11px;font-weight:700;letter-spacing:.03em;text-transform:uppercase;color:var(--muted);margin-top:4px;}
a.metric,button.metric{display:block;text-decoration:none;text-align:left;font-family:inherit;cursor:pointer;width:100%;}
a.metric:active,button.metric:active{border-color:var(--gold);background:var(--gold-pale);}

/* ── CHIPS ── */
.chip{font-size:11px;font-weight:700;letter-spacing:.02em;padding:3px 8px;border-radius:20px;white-space:nowrap;border:0;display:inline-block;}
.chip.ok{background:var(--green-bg);color:var(--green);}
.chip.warn{background:var(--amber-bg);color:var(--amber);}
.chip.flag{background:var(--red-bg);color:var(--red);}
.chip.scan{background:var(--bg);color:var(--muted);}

/* ── SECTION LABEL + ROWS ── */
.sec{font-size:12px;font-weight:800;letter-spacing:.04em;text-transform:uppercase;color:var(--muted);margin:16px 2px 8px;display:flex;justify-content:space-between;align-items:center;gap:8px;}
.row{position:relative;background:var(--surface);border:1px solid var(--line);border-radius:12px;padding:12px 13px;margin-bottom:8px;display:flex;align-items:center;gap:12px;cursor:pointer;transition:border-color .15s;}
.row:active{border-color:var(--gold);background:var(--gold-pale);}
.row .av{width:38px;height:38px;border-radius:50%;background:var(--navy);display:flex;align-items:center;justify-content:center;font-weight:700;font-size:13px;color:#fff;flex-shrink:0;}
.row .main{flex:1;min-width:0;}
.row .t{font-weight:700;font-size:14px;color:var(--bright);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;}
.row .s{font-size:12px;color:var(--muted);margin-top:3px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;}
.row .r{text-align:right;flex-shrink:0;}
.row .amt{font-weight:800;font-size:15px;color:var(--bright);}

/* ── DATA ROWS (key/value) ── */
.kv{display:flex;justify-content:space-between;gap:12px;padding:9px 0;border-bottom:1px solid var(--line);font-size:13px;}
.kv:last-child{border-bottom:none;}
.kv .k{font-size:12px;font-weight:700;color:var(--muted);}
.kv .vv{font-weight:700;color:var(--bright);text-align:right;}
.kv.tot .vv{font-family:'Playfair Display',serif;font-size:17px;color:var(--gold-lt);}
.kv.ded .vv{color:var(--red);}

/* ── BUTTONS ── */
.btn{display:block;width:100%;font-family:inherit;font-size:14px;font-weight:700;padding:13px;border-radius:10px;border:1px solid transparent;cursor:pointer;text-align:center;text-decoration:none;margin-top:9px;}
.btn-gold{background:var(--gold);color:var(--navy-deep);font-weight:800;}
.btn-navy{background:var(--navy);color:#fff;}
.btn-line{background:var(--surface);border-color:var(--line);color:var(--navy);}
.btn-ghost{background:var(--bg);border-color:var(--line);color:var(--muted);}
.btn-green{background:var(--green);color:#fff;}
.btn-danger{background:var(--red-bg);border-color:rgba(179,38,30,.25);color:var(--red);}
.btn:disabled{opacity:.5;}
.btn-row{display:grid;grid-template-columns:1fr 1fr;gap:9px;margin-top:9px;}
.btn-row .btn{margin-top:0;}

/* ── FORM FIELDS ── */
.fld{margin-bottom:11px;}
.fld label{font-size:12px;font-weight:700;color:var(--muted);display:block;margin-bottom:5px;}
.fld input,.fld select,.fld textarea{width:100%;padding:11px 12px;border:1px solid var(--line);border-radius:10px;background:#fff;color:var(--bright);font-size:16px;font-family:inherit;outline:none;}
.fld input:focus,.fld select:focus,.fld textarea:focus{border-color:var(--gold);}
.fld textarea{min-height:96px;resize:vertical;line-height:1.5;}
.frow{display:grid;grid-template-columns:1fr 1fr;gap:10px;}
.ck{display:flex;align-items:center;gap:9px;font-size:14px;margin-bottom:11px;color:var(--bright);}
.ck input{width:18px;height:18px;}

/* ── BOTTOM NAV ── */
.nav{position:fixed;bottom:0;left:0;right:0;z-index:50;background:rgba(255,255,255,.97);backdrop-filter:blur(12px);border-top:1px solid var(--line);display:flex;padding:6px 0 calc(var(--safe-bottom) + 6px);}
.nav a{flex:1;display:flex;flex-direction:column;align-items:center;gap:3px;text-decoration:none;color:var(--muted);padding:4px 0;position:relative;}
.nav a[hidden]{display:none;}
.nav a .ic{width:24px;height:24px;} .nav a .ic svg{display:block;width:24px;height:24px;}
.nav a .lb{font-size:11px;font-weight:700;}
.nav a.on{color:var(--navy);}
.nav a.on .ic{color:var(--gold);}
.nav a .badge{position:absolute;top:0;left:calc(50% + 6px);min-width:18px;height:18px;padding:0 5px;border-radius:9px;background:var(--red);color:#fff;font-size:10px;font-weight:800;display:flex;align-items:center;justify-content:center;}

/* ── SHEET ── */
.sheet-ov{display:none;position:fixed;inset:0;background:rgba(15,28,48,.45);z-index:120;align-items:flex-end;}
.sheet-ov.open{display:flex;}
.sheet{background:var(--surface);border-radius:18px 18px 0 0;width:100%;max-width:620px;margin:0 auto;max-height:90vh;overflow-y:auto;padding:14px 16px calc(var(--safe-bottom) + 26px);}
.sheet-grip{width:36px;height:4px;background:var(--line);border-radius:2px;margin:0 auto 14px;}
.sheet-title{font-family:'Playfair Display',serif;font-weight:800;font-size:19px;margin-bottom:12px;color:var(--navy);}
.sheet-head{display:flex;justify-content:space-between;align-items:center;gap:10px;margin-bottom:12px;}
.sheet-head .sheet-title{margin:0;}
.sheet-x{flex:0 0 auto;width:32px;height:32px;border-radius:50%;border:1px solid var(--line);background:var(--bg);color:var(--muted);font-size:16px;line-height:1;cursor:pointer;display:flex;align-items:center;justify-content:center;}
.sheet-x:active{background:var(--line);}

/* ── MISC ── */
.gate{position:fixed;inset:0;background:var(--navy-deep);color:#fff;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:16px;z-index:200;}
.gate .nm{font-family:'Playfair Display',serif;font-weight:800;font-size:22px;}
.spin{width:24px;height:24px;border:2px solid rgba(255,255,255,.2);border-top-color:var(--gold);border-radius:50%;animation:sp .8s linear infinite;}
@keyframes sp{to{transform:rotate(360deg);}}
.spinning{animation:sp .8s linear infinite;}
.empty{text-align:center;padding:32px 16px;color:var(--muted);font-size:13px;background:var(--surface);border:1px dashed var(--line);border-radius:12px;margin-bottom:8px;}
.tool-grid{display:grid;grid-template-columns:1fr 1fr;gap:10px;}
.tool{position:relative;background:var(--surface);border:1px solid var(--line);border-radius:12px;padding:14px;text-decoration:none;display:flex;flex-direction:column;gap:8px;}
.tool:active{border-color:var(--gold);}
.tool .ti{width:34px;height:34px;border-radius:9px;background:var(--gold-pale);display:flex;align-items:center;justify-content:center;color:var(--gold-lt);}
.tool .ti svg{display:block;width:20px;height:20px;}
.tool .tt{font-weight:700;font-size:14px;color:var(--bright);}
.tool .td{font-size:12px;color:var(--muted);line-height:1.35;}
.proto-note{font-size:11px;color:var(--faint);text-align:center;padding:14px 0 0;}
.app-footer{display:flex;flex-direction:column;align-items:center;gap:3px;padding:20px 0 6px;margin-top:16px;}
.app-footer .af-brand{font-size:11px;font-weight:700;color:var(--muted);}
.app-footer .af-brand .af-ver{color:var(--faint);font-weight:500;}
.app-footer .af-legal{font-size:10px;color:var(--faint);}

/* SMS consent links in the profile panel. */
#pf-sms-consent a{color:var(--gold-lt);text-decoration:underline;}

/* "Not active" group under listings / agreements / referrals: collapsed by default. */
details.more>summary{list-style:none;}
details.more>summary::-webkit-details-marker{display:none;}
details.more>summary::after{content:'Show';font-size:11px;color:var(--gold-lt);}
details.more[open]>summary::after{content:'Hide';}
/* The shared people fields on the phone's New Transaction (js/deal-form-people.js),
   styled as the phone's own fields (audit 2026-11-13). */
#nt-people .dp-head{font-size:12px;font-weight:800;letter-spacing:.04em;text-transform:uppercase;color:var(--muted);margin:16px 2px 8px;}
#nt-people .dp-grid{display:grid;grid-template-columns:1fr 1fr;gap:0 10px;}
#nt-people .dp-grid>div{margin-bottom:11px;min-width:0;}
#nt-people .dp-grid label{font-size:12px;font-weight:700;color:var(--muted);display:block;margin-bottom:5px;}
#nt-people .dp-grid input{width:100%;box-sizing:border-box;padding:11px 12px;border:1px solid var(--line);border-radius:10px;background:#fff;color:var(--bright);font-size:16px;font-family:inherit;outline:none;}
#nt-people .dp-grid input:focus{border-color:var(--gold);}
