/* Phone app feel. On phones AfterLeads behaves like an installed app:
   no rubber-band page bounce, no double-tap zoom delay, no grey tap flash,
   and portrait only. Installed Android apps and full screen lock portrait
   for real (manifest + screen.orientation.lock); everywhere else a phone
   turned sideways sees the "turn your phone upright" screen below. */
.phone-upright { display: none; }

@media (pointer: coarse) and (max-width: 760px) {
  html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
  /* Signed in, the app's own pull to refresh takes over and keeps your place.
     Signed out, the browser's own pull to refresh still reloads the page. */
  html:has(> body.signed-in-mode), body.signed-in-mode { overscroll-behavior-y: none; }
  body { -webkit-tap-highlight-color: transparent; }
  a, button, summary, label, [role="button"] { touch-action: manipulation; }
}

@media (pointer: coarse) and (orientation: landscape) and (max-height: 500px) {
  html, body { overflow: hidden !important; }
  .phone-upright {
    position: fixed; inset: 0; z-index: 2147483000;
    display: grid; place-items: center; align-content: center; gap: 14px;
    padding: max(20px, env(safe-area-inset-top)) max(24px, env(safe-area-inset-right)) max(20px, env(safe-area-inset-bottom)) max(24px, env(safe-area-inset-left));
    background: #f6f7fb; color: #10203f; text-align: center;
    font-family: Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
  }
  body.dark-mode .phone-upright { background: #0f172a; color: #e8edf7; }
  .phone-upright-mark { width: 44px; height: 44px; border-radius: 12px; }
  .phone-upright-phone { width: 56px; height: 56px; color: #00788F; animation: phone-upright-turn 2.4s cubic-bezier(.4, 0, .2, 1) infinite; }
  .phone-upright strong { font-size: 18px; font-weight: 600; letter-spacing: -0.2px; }
  .phone-upright p { margin: 0; max-width: 340px; font-size: 14px; line-height: 1.45; color: #5a6680; }
  body.dark-mode .phone-upright p { color: #a9b4c8; }
  .phone-upright-continue { min-height: 44px; margin-top: 4px; padding: 0 18px; border: 1px solid #c9d3e3; border-radius: 10px; background: transparent; color: inherit; font: inherit; font-size: 14px; font-weight: 600; }
  body.dark-mode .phone-upright-continue { border-color: #354158; }
  /* Everything behind the screen is hidden from touch and screen readers. */
  body > :not(.phone-upright) { visibility: hidden; }
  /* Someone who keeps the phone sideways (a mounted phone, for example) can carry on (WCAG 1.3.4). */
  body.phone-sideways-ok .phone-upright { display: none; }
  body.phone-sideways-ok > :not(.phone-upright) { visibility: visible; }
}

@keyframes phone-upright-turn {
  0%, 20% { transform: rotate(-90deg); }
  55%, 100% { transform: rotate(0deg); }
}

@media (prefers-reduced-motion: reduce) {
  .phone-upright-phone { animation: none; }
}

/* Get the app: the install sheet and the small card that offers it. */
.phone-install { width: min(420px, calc(100vw - 24px)); max-width: none; margin: auto auto max(12px, env(safe-area-inset-bottom)); padding: 0; border: 0; border-radius: 20px; background: transparent; }
.phone-install::backdrop { background: rgba(16, 32, 63, .38); }
.phone-install-card { position: relative; display: grid; gap: 14px; padding: 22px 20px 20px; border-radius: 20px; background: #fff; color: #10203f; font-family: Inter, system-ui, -apple-system, "Segoe UI", sans-serif; box-shadow: 0 18px 48px rgba(16, 32, 63, .22); }
.phone-install-close { position: absolute; top: 10px; right: 10px; width: 36px; height: 36px; border: 0; border-radius: 50%; background: #f1f3f8; color: #5a6680; font-size: 20px; line-height: 1; }
.phone-install-app { display: flex; align-items: center; gap: 14px; }
.phone-install-app img { width: 60px; height: 60px; border-radius: 14px; box-shadow: 0 2px 8px rgba(16, 32, 63, .12); }
.phone-install-app strong { display: block; font-size: 18px; font-weight: 600; letter-spacing: -0.2px; }
.phone-install-app span { font-size: 13px; color: #5a6680; }
.phone-install-lead { margin: 0; font-size: 14px; line-height: 1.5; color: #3d4a63; }
.phone-install-now { min-height: 48px; border: 0; border-radius: 12px; background: #00788F; color: #fff; font: 600 16px/1 Inter, system-ui, sans-serif; }
.phone-install-now:active { background: #006E86; }
.phone-install-steps { display: grid; gap: 10px; margin: 0; padding: 0; list-style: none; counter-reset: install; }
.phone-install-steps li { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 12px; background: #f6f7fb; font-size: 14px; line-height: 1.4; }
.phone-install-steps b { font-weight: 600; }
.phone-install-icon { flex: 0 0 34px; display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; background: #fff; color: #00788F; }
.phone-install-icon svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.phone-install-icon circle { fill: currentColor; stroke: none; }
.phone-install-card-prompt { position: fixed; z-index: 60; left: 12px; right: 12px; bottom: max(12px, env(safe-area-inset-bottom)); display: flex; align-items: center; gap: 12px; padding: 12px 8px 12px 12px; border: 1px solid #e3e7ef; border-radius: 16px; background: #fff; color: #10203f; box-shadow: 0 10px 30px rgba(16, 32, 63, .16); font-family: Inter, system-ui, -apple-system, "Segoe UI", sans-serif; animation: phone-install-in 360ms cubic-bezier(.2, .8, .2, 1); }
.phone-install-card-prompt img { width: 40px; height: 40px; border-radius: 10px; }
.phone-install-card-prompt > span { flex: 1; min-width: 0; display: grid; gap: 2px; }
.phone-install-card-prompt strong { font-size: 14px; font-weight: 600; }
.phone-install-card-prompt small { font-size: 12px; color: #5a6680; }
.phone-install-get { min-height: 40px; padding: 0 14px; border: 0; border-radius: 10px; background: #00788F; color: #fff; font: 600 14px/1 Inter, system-ui, sans-serif; white-space: nowrap; }
.phone-install-dismiss { width: 36px; height: 36px; border: 0; background: none; color: #5a6680; font-size: 20px; }
body.dark-mode .phone-install-card, body.dark-mode .phone-install-card-prompt { background: #16213a; color: #e8edf7; border-color: #26324d; }
body.dark-mode :is(.phone-install-app span, .phone-install-lead, .phone-install-card-prompt small, .phone-install-dismiss) { color: #a9b4c8; }
body.dark-mode .phone-install-steps li, body.dark-mode .phone-install-close { background: #1d2943; }
body.dark-mode .phone-install-icon { background: #0f172a; color: #5CC8DF; }
@keyframes phone-install-in { from { transform: translateY(16px); opacity: 0; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .phone-install-card-prompt { animation: none; } }

/* Get the app: a small floating button that stays until AfterLeads is installed.
   Computers: it floats in the sidebar just above the business and account
   buttons (phone-install.js places it), so it never covers a deal or the message
   box. Phones: bottom left above the tabs, on Home, Deals and You only,
   opposite the Add button. */
.install-fab { display: none; }
html.install-fab-on body.signed-in-mode .install-fab:not([hidden]) { position: fixed; z-index: 85; left: 16px; bottom: 16px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; padding: 0 14px; border: 0; border-radius: 999px; background: #00788F; color: #fff; font: 600 14px/1 Inter, system-ui, -apple-system, "Segoe UI", sans-serif; white-space: nowrap; box-shadow: 0 8px 20px -8px rgba(0, 72, 90, .55); cursor: pointer; animation: phone-install-in 360ms cubic-bezier(.2, .8, .2, 1); }
html.install-fab-on body.signed-in-mode .install-fab:hover { background: #006E86; }
html.install-fab-on body.signed-in-mode .install-fab:focus-visible { outline: 2px solid #00788F; outline-offset: 3px; }
.install-fab svg { flex: 0 0 auto; width: 20px; height: 20px; }
/* Icon sidebar: just the icon (its name is in the label and tooltip). */
html.install-fab-on body.signed-in-mode .install-fab.is-compact:not([hidden]) { width: 40px; height: 40px; padding: 0; }
.install-fab.is-compact span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
/* Phones: bottom left, the same height as the Add button, only on Home, Deals and You. */
html.pa.install-fab-on body.signed-in-mode .install-fab:not([hidden]) { left: 16px; bottom: calc(var(--pa-tabs-h) + 20px); z-index: 296; width: auto; height: auto; min-height: 44px; padding: 0 16px 0 12px; font-size: 14px; transition: transform 200ms ease, opacity 200ms ease; }
html.pa:not([data-pa-screen="cc"]):not([data-pa-screen="opps"]):not([data-pa-screen="account"]) .install-fab,
html.pa:is(.pa-dialog, .pa-has-footer) .install-fab { display: none !important; }
html.pa.pa-fab-away .install-fab { transform: translateY(calc(100% + 32px)); opacity: 0; pointer-events: none; }
/* Never over the guided tour, the setup checklist, an open window or another card. */
html.gt-on .install-fab,
body:has(dialog[open]) .install-fab,
body:has(.setup-pop:not([hidden]):not(.pa-inline)) .install-fab,
body:has(.phone-install-card-prompt) .install-fab { display: none !important; }
body.dark-mode .install-fab { background: #0E8FAA !important; color: #fff !important; }
body.dark-mode .install-fab:hover { background: #0B7F98 !important; }
.phone-install-done { min-height: 44px; border: 1px solid #d8deea; border-radius: 12px; background: #fff; color: #10203f; font: 600 15px/1 Inter, system-ui, sans-serif; }
.phone-install-done[hidden] { display: none; }
body.dark-mode .phone-install-done { background: #1d2943; color: #e8edf7; border-color: #26324d; }
@media (prefers-reduced-motion: reduce) { .install-fab { animation: none !important; transition: none !important; } }
