/* Mary Help — camada visual mobile app. Escopo limitado a telas <= 760px. */
@media (max-width: 760px) {
  :root {
    --mh-ink: #173c34;
    --mh-muted: #687b74;
    --mh-green: #138565;
    --mh-green-soft: #eaf5ef;
    --mh-plum: #5b3975;
    --mh-line: rgba(23, 60, 52, .10);
    --mh-surface: #f5f7f3;
    --mh-safe-bottom: env(safe-area-inset-bottom, 0px);
  }

  html {
    scroll-behavior: smooth;
    scroll-padding-top: 78px;
    -webkit-text-size-adjust: 100%;
  }

  body {
    margin: 0;
    background: var(--mh-surface);
    color: var(--mh-ink);
    overscroll-behavior-y: contain;
  }

  #root { min-height: 100svh; }

  /* Public site: compact, persistent app chrome. */
  .site-shell {
    min-height: 100svh;
    padding-bottom: calc(76px + var(--mh-safe-bottom));
    background: var(--mh-surface);
  }

  .public-header {
    position: sticky;
    top: 0;
    z-index: 60;
    padding-top: env(safe-area-inset-top, 0px);
    border-bottom: 1px solid var(--mh-line);
    background: rgba(250, 251, 248, .92);
    -webkit-backdrop-filter: blur(18px);
    backdrop-filter: blur(18px);
  }

  .public-header .header-inner {
    min-height: 60px;
    padding-inline: 16px;
  }

  /* The published logo image is missing; keep the adjacent wordmark readable. */
  img[src*="/manus-storage/async-images/"] {
    display: none !important;
  }

  .mobile-menu {
    width: 42px;
    height: 42px;
    border: 1px solid var(--mh-line);
    border-radius: 14px;
    background: #fff;
    color: var(--mh-ink);
    box-shadow: 0 4px 14px rgba(18, 49, 41, .06);
    -webkit-tap-highlight-color: transparent;
  }

  .public-mobile-nav {
    position: fixed;
    z-index: 80;
    right: auto;
    bottom: 0;
    left: 50%;
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    width: min(100%, 620px);
    box-sizing: border-box;
    padding: 7px 10px calc(8px + var(--mh-safe-bottom));
    transform: translateX(-50%);
    border: 1px solid rgba(23, 60, 52, .08);
    border-bottom: 0;
    border-radius: 20px 20px 0 0;
    background: rgba(255, 255, 255, .94);
    box-shadow: 0 -10px 30px rgba(23, 60, 52, .10);
    -webkit-backdrop-filter: blur(20px);
    backdrop-filter: blur(20px);
  }

  .public-mobile-nav a {
    display: flex;
    min-width: 0;
    min-height: 48px;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 6px 2px;
    border-radius: 14px;
    color: #66766f;
    font-size: 10px;
    font-weight: 650;
    line-height: 1.1;
    text-align: center;
    text-decoration: none;
    white-space: nowrap;
    -webkit-tap-highlight-color: transparent;
    transition: color .16s ease, background-color .16s ease, transform .16s ease;
  }

  .public-mobile-nav a[aria-current="page"],
  .public-mobile-nav a.active {
    color: var(--mh-green);
    background: var(--mh-green-soft);
  }

  .public-mobile-nav a:active { transform: scale(.96); }
  .public-mobile-nav svg { width: 19px; height: 19px; stroke-width: 1.9; }

  .public-footer {
    padding-bottom: calc(22px + var(--mh-safe-bottom));
  }

  /* Install prompt becomes a compact native-style bottom sheet. */
  .pwa-prompt-backdrop {
    z-index: 70;
    align-items: flex-end !important;
    justify-items: center !important;
    padding: 14px 12px calc(74px + var(--mh-safe-bottom)) !important;
    background: rgba(14, 38, 32, .28) !important;
    -webkit-backdrop-filter: blur(3px);
    backdrop-filter: blur(3px);
  }

  .pwa-prompt {
    display: grid !important;
    grid-template-columns: 42px minmax(0, 1fr);
    gap: 0 12px;
    width: min(100%, 460px);
    max-height: calc(100svh - 130px);
    box-sizing: border-box;
    margin: 0;
    padding: 18px 16px 14px;
    overflow: auto;
    border: 1px solid rgba(23, 60, 52, .08);
    border-radius: 24px;
    background: #fff;
    box-shadow: 0 20px 60px rgba(11, 35, 28, .24);
  }

  .pwa-prompt-icon {
    grid-column: 1;
    grid-row: 1;
    width: 42px;
    height: 42px;
    border-radius: 14px;
    background: var(--mh-green-soft);
    color: var(--mh-green);
  }

  .pwa-prompt > div:not(.pwa-prompt-icon):not(.pwa-prompt-actions) {
    grid-column: 2;
    grid-row: 1;
    min-width: 0;
    align-self: center;
  }

  .pwa-prompt .eyebrow {
    display: block;
    margin: 0 0 3px;
    color: var(--mh-green);
    font-size: 9px;
    letter-spacing: .12em;
  }

  .pwa-prompt h3 {
    margin: 0;
    color: var(--mh-ink);
    font-size: 14px;
    line-height: 1.25;
  }

  .pwa-prompt p:not(.pwa-prompt-hint) {
    margin: 5px 0 0;
    color: var(--mh-muted);
    font-size: 12px;
    line-height: 1.4;
  }

  .pwa-prompt-hint {
    grid-column: 1 / -1;
    margin: 10px 0 0;
    color: var(--mh-muted);
    font-size: 12px;
  }

  .pwa-prompt-actions {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: row;
    gap: 9px;
    margin-top: 14px;
  }

  .pwa-prompt-actions .button {
    min-height: 44px;
    flex: 1 1 0;
    justify-content: center;
    padding-inline: 10px;
    border-radius: 14px;
    font-size: 12px;
  }

  .pwa-prompt-close {
    top: 10px;
    right: 10px;
    width: 28px;
    height: 28px;
    border-radius: 10px;
    background: #f2f5f2;
    color: var(--mh-muted);
  }

  /* Access and registration work as focused app screens, not a split website page. */
  .auth-shell {
    min-height: 100svh;
    background: linear-gradient(155deg, #eaf4ee 0%, #f6f7f3 45%, #f6f7f3 100%);
  }

  .auth-side { display: none !important; }

  .auth-main {
    display: flex;
    min-height: 100svh;
    box-sizing: border-box;
    align-items: flex-start;
    justify-content: center;
    padding: calc(22px + env(safe-area-inset-top, 0px)) 16px calc(24px + var(--mh-safe-bottom));
    background: transparent;
  }

  .auth-card {
    width: min(100%, 480px);
    box-sizing: border-box;
    margin: 0;
    padding: 22px 20px 24px;
    border: 1px solid rgba(23, 60, 52, .08);
    border-radius: 26px;
    background: rgba(255, 255, 255, .96);
    box-shadow: 0 16px 44px rgba(23, 60, 52, .09);
  }

  .auth-card::before {
    display: block;
    margin: 0 0 16px;
    color: var(--mh-ink);
    content: "✦ Mary Help";
    font-size: 18px;
    font-weight: 800;
    letter-spacing: -.04em;
  }

  .auth-back { min-height: 44px; margin-bottom: 18px; }
  .auth-heading { margin-bottom: 22px; }
  .auth-heading h1 { font-size: clamp(1.8rem, 7vw, 2.25rem); line-height: 1.08; }
  .auth-heading p { color: var(--mh-muted); line-height: 1.5; }
  .form-stack { gap: 14px; }

  .form-stack input,
  .form-stack select,
  .form-stack textarea,
  .auth-card input,
  .auth-card select,
  .auth-card textarea {
    min-height: 50px;
    box-sizing: border-box;
    border-radius: 14px;
    font-size: 16px !important;
  }

  .form-stack button,
  .auth-card .button {
    min-height: 50px;
    border-radius: 15px;
  }

  button,
  a.button {
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
  }
}

@media (max-width: 360px) {
  .public-mobile-nav { padding-inline: 6px; }
  .public-mobile-nav a { font-size: 9px; }
  .auth-card { padding-inline: 16px; }
  .pwa-prompt { padding-inline: 12px; }
}


@media (max-width: 760px) {
  /* Do not interrupt authentication; the install prompt remains available on public pages. */
  #root:has(.auth-shell) > .pwa-prompt-backdrop {
    display: none !important;
  }

  /* Lift the install sheet above the fixed five-item app dock. */
  #root:has(.public-mobile-nav) > .pwa-prompt-backdrop {
    padding-bottom: calc(128px + env(safe-area-inset-bottom, 0px)) !important;
  }
}
