/* The phone layout (public/mobile/*.js): on a phone-sized screen Sales shows this instead of the desktop top bar and
   tabs. Built from the approved 9-screen mock-up (Today, Pipeline, Deal, Add, Quick quote, Contacts, Contact, After a
   call, Reports). Every colour is one of the app's own variables (genhq-theme.css), so Day and Night both work.
   Nothing here applies until mobile-core.js puts .m-on on <body>. */

#m-app { display: none; }
body.m-on #m-app { display: block; }
/* The desktop app stays in the page (its windows, wizard and report view are reused), just out of sight. */
body.m-on #app-view { display: none !important; }
body.m-on { overflow: hidden; overscroll-behavior: none; }
/* Never wider than the screen: nothing can push the page sideways (clip where the browser has it, hidden where not). */
html.m-on, html.m-on body { overflow-x: hidden; overflow-x: clip; max-width: 100%; }
/* Every box you type in at 16px or more: below that, iPhone Safari zooms the whole page in when it's tapped and leaves
   it zoomed after the keyboard goes, so the page sits shifted left and down, cut off at the edges (the Contact screen's
   15px text box did it). The quick quote's big kW number is already larger. */
body.m-on :is(input, textarea, select):not([type="checkbox"]):not([type="radio"]):not([type="range"]):not(.m-kw) { font-size: 16px; }
body.m-on::before { display: none; }

#m-app {
  --m-card: var(--surface); --m-chip: var(--surface-2); --m-line: var(--border);
  --m-late: color-mix(in srgb, var(--danger) 65%, #fff 35%);
  --m-tint: color-mix(in srgb, var(--brand) 16%, var(--surface));
  --m-tabs-h: calc(64px + env(safe-area-inset-bottom));
  --m-top: env(safe-area-inset-top);
  position: fixed; inset: 0; z-index: 40; background: var(--bg); color: var(--text);
  font-family: "Poppins", system-ui, -apple-system, sans-serif; font-size: 15px; -webkit-tap-highlight-color: transparent;
}
:root[data-theme="day"] #m-app { --m-late: var(--danger); }
:where(#m-app) *, :where(#m-app) *::before, :where(#m-app) *::after { box-sizing: border-box; }
/* Low-specificity resets (:where), so each control's own class sets its size and colour. */
:where(#m-app) :where(button, input, select, textarea) { font: inherit; color: inherit; }
:where(#m-app) a { color: var(--brand); }
#m-app h1 { margin: 0; font-size: 26px; font-weight: 600; letter-spacing: -0.01em; line-height: 1.2; }
#m-app [hidden] { display: none !important; }
#m-app svg { flex: none; }
.m-big { white-space: nowrap; overflow: hidden; }

/* ---- The page and the bottom tabs ---- */
.m-main { position: absolute; top: 0; left: 0; right: 0; bottom: var(--m-tabs-h); overflow-y: auto; overflow-x: hidden;
  -webkit-overflow-scrolling: touch; padding: calc(16px + var(--m-top)) 16px 104px; }
.m-main.m-foot-room { padding-bottom: 120px; }
.m-tabs { position: absolute; left: 0; right: 0; bottom: 0; height: var(--m-tabs-h); padding: 6px 0 env(safe-area-inset-bottom);
  display: flex; background: var(--nav); border-top: 1px solid var(--m-line); z-index: 3; }
#m-app .m-tab[hidden] { display: none !important; }
.m-tab { flex: 1 1 0; min-width: 0; min-height: 52px; display: flex; flex-direction: column; align-items: center; justify-content: flex-start;
  gap: 3px; padding: 4px 0 0; color: var(--muted); text-decoration: none !important; font-size: 11px; font-weight: 500; background: none; border: 0; }
#m-app .m-tab { color: var(--muted); }
#m-app .m-tab.on { color: var(--brand); }
.m-plus { width: 52px; height: 46px; border-radius: 16px; background: var(--brand); color: var(--g-ink); display: grid; place-items: center; }
/* Six along the bottom when Sam's there: the (+) a little narrower so each still gets 60px at 360 wide. */
.m-tabs.m-6 .m-plus { width: 48px; }
/* Sam: her photo in a ring; the ring goes green while she's on. */
.m-sam-face { width: 30px; height: 30px; border-radius: 50%; overflow: hidden; display: block; background: #fff; box-shadow: 0 0 0 2px var(--m-line); transition: box-shadow .2s; }
.m-sam-face img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 18%; display: block; }
#m-app .m-tab-sam { cursor: pointer; font: inherit; font-size: 11px; font-weight: 500; }
#m-app .m-tab-sam.on { color: var(--brand); }
.m-tab-sam.on .m-sam-face { box-shadow: 0 0 0 2.5px var(--brand), 0 0 0 6px color-mix(in srgb, var(--brand) 25%, transparent); }
/* Where Sam's strip docks: just above the tabs, over the bottom of the page (which stays in view above it). */
.m-talk { position: absolute; left: 0; right: 0; bottom: var(--m-tabs-h); z-index: 6; }
body.m-talking .m-main::after { content: ""; display: block; height: var(--m-talk-h, 0px); }
:root[data-theme="day"] .m-plus { color: #fff; }

/* A sticky header for screens that keep their title and filters on top while the list scrolls. */
.m-sticky { position: sticky; top: calc(-16px - var(--m-top)); z-index: 2; background: var(--bg); margin: calc(-16px - var(--m-top)) -16px 0; padding: calc(16px + var(--m-top)) 16px 8px; }

/* ---- Building blocks ---- */
.m-card { background: var(--m-card); border: 1px solid var(--m-line); border-radius: 18px; }
#m-app a.m-card, #m-app button.m-card { display: block; width: 100%; text-align: left; color: var(--text); text-decoration: none; }
#m-app .m-card.m-row { display: flex; }
.m-sec { font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .07em; margin: 24px 4px 10px;
  display: flex; justify-content: space-between; gap: 10px; }
.m-sec > span:last-child { text-transform: none; letter-spacing: 0; }
.m-muted { color: var(--muted); }
.m-small { font-size: 12.5px; }
.m-late { color: var(--m-late) !important; }
.m-ok { color: var(--brand) !important; }
.m-ell { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.m-list { display: flex; flex-direction: column; gap: 10px; }
.m-row { display: flex; align-items: center; gap: 10px; }
.m-grow { flex: 1 1 auto; min-width: 0; }
.m-ib { width: 44px; height: 44px; border-radius: 14px; background: var(--m-chip); color: var(--text); display: grid; place-items: center;
  border: 0; text-decoration: none !important; cursor: pointer; flex: none; padding: 0; }
#m-app a.m-ib { color: var(--text); }
.m-ib:disabled, .m-ib[aria-disabled="true"] { opacity: .35; pointer-events: none; }
.m-ib.m-go { background: var(--brand); color: var(--g-ink); border-radius: 50%; }
.m-big { flex: 1 1 0; min-width: 0; height: 48px; border-radius: 14px; background: var(--m-chip); color: var(--text); display: flex; align-items: center;
  justify-content: center; gap: 8px; text-decoration: none !important; font-size: 14px; font-weight: 600; border: 0; cursor: pointer; padding: 0 10px; }
#m-app a.m-big { color: var(--text); }
/* Stacked (not side by side), a big button keeps its height. */
.m-list > .m-big, .m-sheet-body > .m-big { flex: none; }
#m-app .m-big.m-primary, #m-app .m-btn.m-primary { background: var(--brand); color: var(--g-ink); }
:root[data-theme="day"] #m-app .m-big.m-primary, :root[data-theme="day"] #m-app .m-btn.m-primary, :root[data-theme="day"] #m-app .m-ib.m-go { color: #fff; }
.m-btn { width: 100%; height: 52px; border-radius: 16px; border: 0; background: var(--m-chip); color: var(--text); font-weight: 600; font-size: 15px;
  display: grid; place-items: center; cursor: pointer; text-decoration: none !important; }
.m-btn:disabled, .m-big:disabled { opacity: .5; }
.m-chip { display: inline-block; font-size: 11.5px; font-weight: 600; padding: 3px 9px; border-radius: 999px; background: var(--m-chip); color: var(--muted); white-space: nowrap; }
.m-chip.m-chip-go { background: var(--m-tint); color: var(--brand); }
.m-chip.m-chip-warn { background: color-mix(in srgb, var(--sun) 18%, var(--surface)); color: var(--sun); }
.m-chip.m-chip-blue { background: color-mix(in srgb, var(--blue, #5b9df6) 18%, var(--surface)); color: var(--blue, #5b9df6); }
.m-avatar { width: 44px; height: 44px; border-radius: 50%; color: #fff; display: grid; place-items: center; font-weight: 600; flex: none; overflow: hidden; border: 0; padding: 0; }
.m-avatar img { width: 100%; height: 100%; object-fit: cover; }
.m-empty { text-align: center; color: var(--muted); font-size: 14px; padding: 28px 12px; }
.m-error { color: var(--m-late); font-size: 13.5px; margin: 8px 2px; }
.m-loading { display: flex; align-items: center; justify-content: center; gap: 10px; color: var(--muted); font-size: 14px; padding: 28px 0; }
.m-spin { width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--m-line); border-top-color: var(--brand); animation: m-spin .8s linear infinite; }
@keyframes m-spin { to { transform: rotate(360deg); } }
.m-skel { height: 72px; border-radius: 18px; background: linear-gradient(90deg, var(--m-card), var(--m-chip), var(--m-card)); background-size: 200% 100%; animation: m-skel 1.4s linear infinite; }
@keyframes m-skel { to { background-position: -200% 0; } }
.m-sr { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Fields */
.m-lbl { font-size: 12.5px; font-weight: 600; color: var(--muted); margin: 16px 2px 8px; display: block; }
.m-fld { width: 100%; height: 52px; border-radius: 14px; border: 1px solid var(--m-line); background: var(--m-card); color: var(--text); padding: 0 14px; font-size: 16px; }
textarea.m-fld { height: auto; min-height: 84px; padding: 12px 14px; resize: none; line-height: 1.4; }
select.m-fld { appearance: none; -webkit-appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 20px) 50%, calc(100% - 15px) 50%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 36px; }
.m-fld:focus { outline: none; border-color: color-mix(in srgb, var(--brand) 70%, var(--m-line)); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 18%, transparent); }
.m-search { position: relative; display: block; }
.m-search svg { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.m-search .m-fld { padding-left: 44px; height: 50px; border-radius: 16px; }
.m-seg { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); background: var(--m-card); border-radius: 12px; padding: 3px; }
.m-seg button { height: 38px; border: 0; border-radius: 10px; background: none; color: var(--muted); font-weight: 500; font-size: 13.5px; cursor: pointer; }
.m-seg button.on { background: var(--m-chip); color: var(--text); }
.m-seg button:disabled { opacity: .4; }
.m-flt { height: 38px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--m-line); background: var(--m-card); color: var(--muted); font-weight: 500; font-size: 13px; cursor: pointer; flex: none; }
.m-flt.on { background: var(--brand); color: var(--g-ink); border-color: var(--brand); }
:root[data-theme="day"] .m-flt.on { color: #fff; }
.m-scrollx { display: flex; gap: 8px; overflow-x: auto; margin: 0 -16px; padding: 10px 16px; scrollbar-width: none; }
.m-scrollx::-webkit-scrollbar { display: none; }
.m-chips { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.m-chips.m-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.m-ch { min-height: 48px; border-radius: 14px; border: 1px solid var(--m-line); background: var(--m-chip); color: var(--muted); font-weight: 500; font-size: 14px;
  cursor: pointer; padding: 6px 8px; line-height: 1.2; }
.m-ch.on { background: var(--m-tint); border-color: var(--brand); color: var(--brand); }

/* ---- Today ---- */
.m-hello { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.m-targets { margin-top: 18px; padding: 14px 16px; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.m-target-l { font-size: 12px; color: var(--muted); }
.m-target-n { font-size: 18px; font-weight: 600; }
.m-target-n span { color: var(--muted); font-size: 13px; font-weight: 500; }
.m-bar { height: 6px; border-radius: 3px; background: var(--m-chip); overflow: hidden; margin-top: 4px; }
.m-bar i { display: block; height: 100%; background: var(--brand); border-radius: 3px; }
.m-time { width: 56px; flex: none; text-align: center; background: var(--m-tint); border-radius: 12px; padding: 6px 0; color: var(--brand); }
.m-time b { display: block; font-size: 17px; font-weight: 700; }
.m-time small { font-size: 11px; }
.m-time.m-plain { background: none; color: var(--muted); }
.m-time.m-plain b { font-size: 16px; font-weight: 600; color: var(--text); }
.m-check { width: 30px; height: 30px; border-radius: 50%; border: 2px solid var(--faint); background: none; display: grid; place-items: center;
  color: transparent; cursor: pointer; flex: none; padding: 0; }
.m-check.m-done { background: var(--brand); border-color: var(--brand); color: var(--g-ink); }
.m-check-hit { width: 44px; height: 44px; display: grid; place-items: center; flex: none; margin: -7px; background: none; border: 0; padding: 0; cursor: pointer; }
.m-task { padding: 12px; }
.m-task.m-faded { opacity: .5; }
.m-task-who { flex: 1; min-width: 0; text-decoration: none !important; color: var(--text) !important; background: none; border: 0; padding: 0; text-align: left; cursor: pointer; }
.m-task-who b { display: block; font-size: 15px; font-weight: 600; }
.m-task-who small { display: block; font-size: 12.5px; color: var(--muted); }

/* ---- Pipeline ---- */
.m-stage { flex: none; height: 40px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--m-line); background: var(--m-card); color: var(--muted);
  font-weight: 500; font-size: 13.5px; display: flex; align-items: center; gap: 7px; cursor: pointer; white-space: nowrap; }
.m-stage b { font-weight: 600; font-size: 12px; background: var(--m-chip); border-radius: 999px; padding: 1px 7px; color: var(--text); }
.m-stage.on { background: var(--brand); color: var(--g-ink); border-color: var(--brand); }
.m-stage.on b { background: var(--g-ink); color: var(--brand); }
:root[data-theme="day"] .m-stage.on { color: #fff; }
:root[data-theme="day"] .m-stage.on b { background: #fff; color: var(--brand); }
.m-deal { padding: 14px 16px; }
.m-deal-top { display: flex; justify-content: space-between; gap: 10px; font-size: 15.5px; font-weight: 600; }
.m-deal-top span:last-child { color: var(--brand); white-space: nowrap; }
.m-deal-foot { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: 10px; font-size: 12px; color: var(--muted); }
.m-owner { width: 22px; height: 22px; border-radius: 50%; color: #fff; display: inline-grid; place-items: center; font-size: 10.5px; font-weight: 600; flex: none; }

/* ---- Deal and contact ---- */
.m-topbar { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.m-value { font-size: 28px; font-weight: 700; color: var(--brand); margin-top: 4px; }
.m-stagecard { margin-top: 14px; padding: 14px 16px; cursor: pointer; font: inherit; }
.m-pill { height: 36px; padding: 0 14px; border-radius: 999px; background: var(--brand); color: var(--g-ink); font-size: 13px; font-weight: 600; display: flex; align-items: center; flex: none; }
:root[data-theme="day"] .m-pill { color: #fff; }
.m-segs { display: flex; gap: 4px; margin-top: 12px; }
.m-segs i { flex: 1; height: 6px; border-radius: 3px; background: var(--m-chip); display: block; }
.m-segs i.on { background: var(--brand); }
.m-acts { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); margin-top: 18px; }
.m-act { display: flex; flex-direction: column; align-items: center; gap: 6px; color: var(--muted) !important; font-size: 12px; font-weight: 500; text-decoration: none !important;
  background: none; border: 0; padding: 0; cursor: pointer; }
.m-act span { width: 56px; height: 56px; border-radius: 18px; background: var(--m-tint); color: var(--brand); display: grid; place-items: center; }
.m-act[aria-disabled="true"] { opacity: .35; pointer-events: none; }
.m-sub { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); border-bottom: 1px solid var(--m-line); margin-top: 20px; }
.m-sub button { height: 44px; border: 0; background: none; color: var(--muted); font-weight: 500; font-size: 13.5px; cursor: pointer; border-bottom: 2px solid transparent; }
.m-sub button.on { color: var(--text); border-bottom-color: var(--brand); }
.m-kv { display: flex; justify-content: space-between; gap: 12px; padding: 13px 0; border-bottom: 1px solid var(--border-soft); font-size: 14px; }
.m-kv > span:first-child { color: var(--muted); flex: none; }
.m-kv > :last-child { text-align: right; min-width: 0; overflow-wrap: anywhere; }
.m-note { padding: 12px 14px; }
.m-note-meta { font-size: 12px; color: var(--muted); }
.m-note-body { font-size: 14px; margin-top: 3px; white-space: pre-wrap; overflow-wrap: anywhere; }
.m-addline { display: flex; gap: 8px; align-items: center; }
.m-addline .m-fld { height: 46px; flex: 1; min-width: 0; }
.m-face { width: 72px; height: 72px; border-radius: 50%; color: #fff; display: grid; place-items: center; font-size: 26px; font-weight: 600; margin: 0 auto; }
.m-ev { display: flex; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--border-soft); }
.m-ev-dot { width: 34px; height: 34px; border-radius: 50%; background: var(--m-chip); color: var(--muted); display: grid; place-items: center; flex: none; }
.m-ev-dot.m-in { background: var(--m-tint); color: var(--brand); }
.m-ev a.m-ev-link { color: var(--text); text-decoration: none; }
.m-composer { position: absolute; left: 0; right: 0; bottom: var(--m-tabs-h); min-height: 66px; background: var(--nav); border-top: 1px solid var(--m-line);
  display: flex; align-items: center; gap: 8px; padding: 10px 12px; z-index: 3; }
.m-composer textarea { flex: 1; min-width: 0; height: 44px; max-height: 120px; border-radius: 22px; border: 1px solid var(--m-line); background: var(--m-card);
  color: var(--text); padding: 10px 16px; font-size: 16px; resize: none; line-height: 1.35; }
/* "Draft with Sam": a pen with a sparkle (her face is on the Sam tab, not here too). */
#m-app .m-draft { background: var(--m-tint); color: var(--brand); border-radius: 50%; }

/* ---- Add sheet and sheets in general ---- */
.m-sheet-wrap { position: fixed; inset: 0; z-index: 45; background: rgba(0, 0, 0, .55); display: flex; align-items: flex-end; animation: m-fade .15s ease-out; }
.m-sheet { width: 100%; max-height: calc(100% - 40px - var(--m-top)); overflow-y: auto; background: var(--m-card); border-radius: 26px 26px 0 0;
  padding: 10px 16px calc(24px + env(safe-area-inset-bottom)); animation: m-up .2s ease-out; overscroll-behavior: contain; }
.m-sheet.m-tall { height: calc(100% - 40px - var(--m-top)); }
.m-grab { width: 40px; height: 5px; border-radius: 3px; background: var(--faint); margin: 0 auto 12px; }
.m-sheet-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin: 0 2px 10px; }
.m-sheet-head h2 { margin: 0; font-size: 19px; font-weight: 600; }
.m-sheet .m-fld, .m-sheet .m-ch { background: var(--m-chip); }
.m-opt { width: 100%; min-height: 52px; border: 0; border-radius: 14px; background: none; color: var(--text); font-size: 15px; font-weight: 500;
  display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 0 14px; cursor: pointer; text-align: left; }
.m-opt.on { background: var(--m-tint); color: var(--brand); }
.m-opt small { color: var(--muted); font-weight: 400; font-size: 12.5px; }
.m-tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.m-tile { background: var(--m-chip); border-radius: 18px; min-height: 96px; padding: 14px; display: flex; flex-direction: column; justify-content: space-between;
  gap: 8px; text-decoration: none !important; color: var(--text) !important; font-size: 14px; font-weight: 600; border: 0; text-align: left; cursor: pointer; }
.m-tile .m-i { width: 40px; height: 40px; border-radius: 12px; background: var(--m-tint); color: var(--brand); display: grid; place-items: center; }
.m-tile small { display: block; font-size: 11.5px; font-weight: 400; color: var(--muted); margin-top: 2px; }
.m-tile.m-hero { background: var(--brand); color: var(--g-ink) !important; }
.m-tile.m-hero .m-i { background: var(--g-ink); color: var(--brand); }
.m-tile.m-hero small { color: color-mix(in srgb, var(--g-ink) 75%, var(--brand)); }
:root[data-theme="day"] .m-tile.m-hero { color: #fff !important; }
:root[data-theme="day"] .m-tile.m-hero small { color: rgba(255, 255, 255, .85); }
:root[data-theme="day"] .m-tile.m-hero .m-i { background: #fff; }
.m-checkline { display: flex; gap: 12px; align-items: flex-start; margin-top: 12px; background: var(--m-chip); border-radius: 14px; padding: 12px 14px; cursor: pointer; font-size: 14px; }
.m-checkline input { width: 22px; height: 22px; accent-color: var(--brand); flex: none; margin: 0; }
@keyframes m-up { from { transform: translateY(40px); opacity: .4; } }
@keyframes m-fade { from { opacity: 0; } }

/* ---- Quick quote ---- */
.m-step { width: 56px; height: 56px; border-radius: 16px; border: 0; background: var(--m-chip); color: var(--text); font-size: 26px; font-weight: 600; cursor: pointer; flex: none; }
.m-kw { width: 100%; min-width: 0; border: 0; background: none; text-align: center; font-size: 38px; font-weight: 700; line-height: 1; color: var(--text); padding: 0; -moz-appearance: textfield; }
#m-app .m-kw:focus { outline: none; box-shadow: none; border: 0; }
.m-kw::-webkit-outer-spin-button, .m-kw::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.m-range { width: 100%; accent-color: var(--brand); height: 32px; margin-top: 10px; }
.m-price { margin-top: 16px; background: var(--m-tint); border-radius: 18px; padding: 16px; display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; }
.m-price-n { font-size: 30px; font-weight: 700; color: var(--brand); line-height: 1.2; }
.m-foot { position: absolute; left: 0; right: 0; bottom: 0; padding: 12px 16px calc(14px + env(safe-area-inset-bottom)); background: var(--nav); border-top: 1px solid var(--m-line);
  display: flex; gap: 10px; z-index: 4; }
.m-foot .m-btn { flex: 1; }
.m-foot .m-btn.m-primary { flex: 1.6; }
.m-details { margin-top: 16px; border: 1px solid var(--m-line); border-radius: 18px; background: var(--m-card); }
.m-details summary { list-style: none; cursor: pointer; padding: 14px 16px; font-weight: 600; font-size: 14px; display: flex; justify-content: space-between; gap: 8px; min-height: 48px; align-items: center; }
.m-details summary::-webkit-details-marker { display: none; }
.m-details[open] summary { border-bottom: 1px solid var(--m-line); }
.m-details .m-details-in { padding: 0 16px 16px; }
.m-grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.m-grid2 .m-lbl { margin-top: 12px; }

/* ---- Desktop screens shown inside the phone layout (New report, a full report) ---- */
.m-embedbar { display: none; }
body.m-on.m-embed #app-view { display: block !important; position: fixed; top: calc(60px + env(safe-area-inset-top)); left: 0; right: 0; bottom: calc(64px + env(safe-area-inset-bottom));
  overflow-y: auto; overflow-x: hidden; -webkit-overflow-scrolling: touch; z-index: 39; background: var(--bg); }
/* The phone layout's own layer sits on top but lets taps through to the desktop screen between its bars. */
body.m-on.m-embed #m-app { background: transparent; pointer-events: none; }
body.m-on.m-embed #m-app > * { pointer-events: auto; }
body.m-on.m-embed #app-view .topbar, body.m-on.m-embed #app-view .tabbar { display: none; }
body.m-on.m-embed #app-view .content { padding: 14px 12px 40px; }
body.m-on.m-embed .m-main { display: none; }
body.m-on.m-embed .m-embedbar { display: flex; position: absolute; top: 0; left: 0; right: 0; height: calc(60px + env(safe-area-inset-top)); padding: env(safe-area-inset-top) 12px 0;
  align-items: center; gap: 12px; background: var(--nav); border-bottom: 1px solid var(--m-line); z-index: 3; }
.m-embedbar b { font-size: 17px; font-weight: 600; }

/* ---- Sam (GenHQ's panel): on a phone, never her floating picture or pop-up (the Sam tab talks to her instead, in the
   strip in .m-talk). GenHQ's script hides them for <html data-genava-launcher="off">; this keeps them hidden even if
   that script is an older one. ---- */
body.m-on > #generations-ava { display: none !important; }

/* The app's own toast, above the tabs. */
body.m-on .app-toast { bottom: calc(80px + env(safe-area-inset-bottom)); max-width: calc(100vw - 32px); text-align: center; }
/* The desktop windows reused on the phone (Email, New opportunity, link a report): full width, room to scroll. */
body.m-on .modal-overlay { padding: 12px; align-items: flex-start; }
body.m-on .modal-card { max-width: 100% !important; padding: 18px 16px; }

@media (prefers-reduced-motion: reduce) {
  .m-sheet, .m-sheet-wrap, .m-spin, .m-skel { animation: none; }
}

/* The Sam tab held down (hold to talk): no iPhone picture menu, and a red ring while she's listening. */
#m-app .m-tab-sam { -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; touch-action: none; }
.m-sam-face img { pointer-events: none; -webkit-user-drag: none; }
#m-app .m-tab-sam.ava-holding { color: #e5484d; }
.m-tab-sam.ava-holding .m-sam-face { transform: scale(1.2); box-shadow: 0 0 0 2.5px #e5484d, 0 0 0 7px rgba(229, 72, 77, 0.3); transition: transform .15s, box-shadow .15s; }

/* The card above the tabs while Sam's tab is held (walkie-talkie): Listening… and the words as they're heard. */
.m-hold-card { position: fixed; left: 12px; right: 12px; bottom: calc(96px + env(safe-area-inset-bottom, 0px)); z-index: 80; padding: 14px 16px; border-radius: 18px; background: rgba(20, 22, 26, 0.97); color: #fff; border: 1px solid rgba(255, 255, 255, 0.08); box-shadow: 0 14px 40px rgba(0, 0, 0, 0.45); }
.m-hold-card[hidden] { display: none; }
.m-hold-card.rec { border-color: rgba(229, 72, 77, 0.55); }
.m-hold-top { display: flex; align-items: center; gap: 10px; font-size: 16px; }
.m-hold-top b { font-weight: 700; }
.m-hold-hint { margin-left: auto; font-size: 13px; color: rgba(255, 255, 255, 0.6); }
.m-hold-dot { width: 12px; height: 12px; border-radius: 50%; background: #e5484d; flex: none; animation: mHoldPulse 1s ease-in-out infinite; }
@keyframes mHoldPulse { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: 0.45; transform: scale(0.8); } }
.m-hold-card p { margin: 8px 0 0; font-size: 15px; line-height: 1.4; color: rgba(255, 255, 255, 0.85); max-height: 7.2em; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 5; -webkit-box-orient: vertical; }
.m-hold-card.sending .m-hold-top b::after { content: ""; }
