/* Keep the existing viewport-width boundary; desktop styles remain unchanged. */
.mobile-tabbar, .mobile-auth-topbar { display: none; }
.mobile-brand { display: flex; align-items: center; gap: .5rem; text-decoration: none; }
.mobile-brand-name { display: none; }

@media (max-width: 767.98px) {
  body.app-shell {
    --app-accent: #288c91;
    --app-tab-height: 68px;
    background: #f4f7f8 !important;
    color: #263d47;
    padding-bottom: calc(var(--app-tab-height) + env(safe-area-inset-bottom, 0px));
    -webkit-tap-highlight-color: transparent;
  }
  .app-shell main { min-width: 0; }
  .app-shell .site-header {
    position: sticky; top: 0; z-index: 1020;
    padding-top: env(safe-area-inset-top, 0px);
    background: #ffffffed; backdrop-filter: blur(16px);
    border-bottom: 1px solid #e5edef;
  }
  .app-shell .mobile-header { height: 60px; padding: 0 18px; }
  .app-shell .mobile-header-logo { width: 36px; height: 36px; }
  .app-shell .mobile-brand-name { display: block; color: #29434d; font-size: 1.1rem; font-weight: 800; }
  .app-shell .mobile-brand-name small { color: #6c848b; font-size: .65rem; margin-left: .3rem; letter-spacing: .05em; }
  .app-shell .mobile-menu-button { width: 44px; height: 44px; background: #eff5f5; border-radius: 14px; gap: 5px; }
  .app-shell .mobile-menu-button span { width: 20px; height: 2px; background: #47656e; }
  .app-shell .mobile-menu { border-radius: 24px 0 0 24px; padding-top: env(safe-area-inset-top, 0px); }
  .app-shell .mobile-menu-link, .app-shell .mobile-sub-link, .app-shell .mobile-account-btn { min-height: 48px; border-radius: 12px; }
  .app-shell .mobile-menu-link { padding: .85rem .65rem; font-size: .95rem; }
  .app-shell .mobile-menu-link:hover { background: #edf6f4; }
  .app-shell .mobile-bottom-links { padding-bottom: env(safe-area-inset-bottom, 0px); }

  .app-shell .mobile-tabbar {
    display: grid; grid-template-columns: repeat(5, minmax(0, 1fr));
    position: fixed; bottom: 0; left: 0; right: 0; z-index: 1030;
    min-height: calc(var(--app-tab-height) + env(safe-area-inset-bottom, 0px));
    padding: 7px max(8px, env(safe-area-inset-left, 0px)) calc(7px + env(safe-area-inset-bottom, 0px));
    background: #fffffff2; backdrop-filter: blur(16px);
    border-top: 1px solid #e1ebed; box-shadow: 0 -5px 24px #25434b08;
  }
  .app-shell .mobile-tabbar a {
    display: flex; align-items: center; justify-content: center; flex-direction: column;
    gap: 4px; min-height: 52px; text-decoration: none; color: #788c95;
    font-size: .67rem; font-weight: 600; border-radius: 14px;
  }
  .app-shell .mobile-tabbar svg { width: 23px; height: 23px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
  .app-shell .mobile-tabbar a.active { color: #207c82; background: #ebf6f4; font-weight: 800; }
  .app-shell .mobile-tabbar a:focus-visible { outline: 2px solid var(--app-accent); outline-offset: -2px; }
  .app-shell.mobile-keyboard-open .mobile-tabbar { visibility: hidden; pointer-events: none; }
  .app-shell .mobile-auth-topbar { display: flex; justify-content: space-between; align-items: center; padding: calc(16px + env(safe-area-inset-top, 0px)) 20px 12px; color: #54717a; font-size: .9rem; }
  .app-shell .mobile-auth-topbar a { color: #288c91; text-decoration: none; padding: .5rem 0; }

  .app-shell main > .container { padding: 20px 16px !important; }
  .app-shell main h1.display-5 { font-size: 1.4rem; line-height: 1.5; }
  .app-shell main h2 { overflow-wrap: anywhere; }
  .app-shell main > .container > .p-5 { padding: 1.25rem !important; border-radius: 20px !important; background: white !important; }
  .app-shell .btn { min-height: 44px; border-radius: 12px; display: inline-flex; align-items: center; justify-content: center; }
  .app-shell .btn-primary { --bs-btn-bg: #288c91; --bs-btn-border-color: #288c91; --bs-btn-hover-bg: #21777b; --bs-btn-hover-border-color: #21777b; --bs-btn-active-bg: #21777b; }
  .app-shell .form-control, .app-shell .form-select { min-height: 48px; font-size: 16px; border-radius: 12px; border-color: #dce6e9; }
  .app-shell textarea.form-control { min-height: 96px; }
  .app-shell input:focus, .app-shell select:focus, .app-shell textarea:focus { border-color: #76b8b5; box-shadow: 0 0 0 3px #288c9115; }

  .app-shell .hero { margin: 16px 16px 0; padding: 1.4rem 1.2rem; border-radius: 24px; background: linear-gradient(135deg, #e5f3ef, #fff2e9); text-align: left; }
  .app-shell .hero-logo { width: 56px; height: 56px; object-fit: contain; margin-bottom: .7rem; }
  .app-shell .hero-title { margin: 0; font-size: 1.45rem; color: #28474d; }
  .app-shell .hero-sub { font-size: .9rem; margin: .6rem 0 0; line-height: 1.7; }
  .app-shell .hero .precare-btn { width: 100%; min-height: 48px; margin-top: 1.1rem !important; background: #288c91; border-radius: 14px; }
  .app-shell .survey-chart-section { margin: 0; padding: 1.6rem 0 1rem; background: transparent; }
  .app-shell .survey-chart-section > .container { padding: 0 16px; }
  .app-shell .survey-chart-section .text-center { text-align: left !important; }
  .app-shell .survey-chart-title { margin-top: 0; font-size: 1.15rem; color: #28474d; }
  .app-shell .survey-chart-subtitle { margin: .35rem 0 1rem; font-size: .8rem; }
  .app-shell .survey-chart-section .row { display: grid; grid-auto-flow: column; grid-auto-columns: calc(100% - 24px); overflow-x: auto; scroll-snap-type: x mandatory; gap: 12px; margin: 0; padding: 0 0 12px; }
  .app-shell .survey-chart-section .row > div { width: auto; margin: 0; padding: 0; scroll-snap-align: start; }
  .app-shell .survey-chart-card { padding: 1rem; border: 1px solid #e3ebed; border-radius: 20px; box-shadow: 0 3px 12px #28474d05; }
  .app-shell .survey-chart-card h5 { font-size: .95rem; }
  .app-shell .chart-wrapper { height: 220px; margin-top: .85rem; }
  .app-shell .chart-empty { height: 220px; font-size: .85rem; }
  .app-shell .chart-range-btn { min-height: 36px; padding: .4rem .7rem; font-size: .75rem; }
  .app-shell .pregnancy-section { padding: 1.25rem 16px !important; margin-top: 0; background: transparent; }
  .app-shell .pregnancy-main-title { font-size: 1.15rem; text-align: left !important; }
  .app-shell .current-week-wrapper { background: white; border: 1px solid #e3ebed; padding: 1rem; border-radius: 18px; }
  .app-shell .current-week-line { font-size: 1.15rem; line-height: 1.6; }
  .app-shell .week-info-row { gap: 10px; margin: 0 0 1rem !important; }
  .app-shell .week-info-row > div { width: 100%; padding: 0; }
  .app-shell .week-info-card { padding: 1rem; border-radius: 18px; }
  .app-shell .week-info-card h5 { font-size: .9rem; }
  .app-shell .week-info-card p { display: block; overflow: visible; -webkit-line-clamp: unset; font-size: .88rem; line-height: 1.8; }
  .app-shell .period-card { padding: 1rem .35rem; border-radius: 16px; }
  .app-shell .period-card h3 { font-size: .82rem; line-height: 1.6; }
  .app-shell .card-section { margin-top: 0; padding: 1.5rem 0; background: transparent; }
  .app-shell .service-title h2 { font-size: 1.15rem; text-align: left; }
  .app-shell .info-card { border-radius: 18px; background: white; border: 1px solid #e3ebed; box-shadow: none; }

  .app-shell .mobile-survey-list > a { margin-bottom: 12px; }
  .app-shell .mobile-survey-list .survey-card { transform: none; border-radius: 18px; background: white; border: 1px solid #e3ebed; box-shadow: 0 3px 10px #28474d05; }
  .app-shell .mobile-survey-list .survey-card:hover { transform: none; }
  .app-shell .mobile-survey-list .survey-card > .row { flex-wrap: nowrap; padding: 12px 24px 12px 16px; gap: 12px; position: relative; }
  .app-shell .mobile-survey-list .survey-card > .row::after { content: '›'; position: absolute; right: 10px; top: calc(50% - 14px); color: #93a7ac; font-size: 22px; }
  .app-shell .mobile-survey-list .col-md-3 { flex: 0 0 68px; width: 68px; }
  .app-shell .mobile-survey-list .col-md-9 { flex: 1; min-width: 0; }
  .app-shell .mobile-survey-list .survey-img { width: 68px; height: 68px; object-fit: cover; border-radius: 14px; }
  .app-shell .mobile-survey-list .card-body { padding: 0 !important; }
  .app-shell .mobile-survey-list .card-title { font-size: .95rem !important; line-height: 1.65; overflow-wrap: anywhere; }
  .app-shell .mobile-survey-list .survey-label { width: 4px; }
  .app-shell .mobile-survey-form .fs-4 { font-size: .95rem !important; line-height: 1.8; }
  .app-shell .mobile-survey-form figure { background: white; border: 1px solid #e2ebed; border-radius: 18px; padding: 1.1rem; margin-bottom: 14px; }
  .app-shell .mobile-survey-form .blockquote { font-size: 1rem; line-height: 1.65; font-weight: 600; }
  .app-shell .mobile-survey-form .blockquote-footer { margin-top: .4rem; font-size: .85rem; }
  .app-shell .mobile-survey-form .form-check { display: flex; align-items: flex-start; gap: .7rem; min-height: 48px; padding: .75rem; margin: .6rem 0 0 !important; border: 1px solid #e4ecee; border-radius: 12px; }
  .app-shell .mobile-survey-form .form-check-input { flex-shrink: 0; margin: .2rem 0 0; width: 20px; height: 20px; }
  .app-shell .mobile-survey-form .form-check-label { flex: 1; line-height: 1.65; font-size: .9rem; }
  .app-shell .mobile-survey-form .form-check:has(input:checked) { border-color: #59a9a5; background: #edf8f5; }
  .app-shell .mobile-survey-form .form-check-input:checked { background-color: #288c91; border-color: #288c91; }
  .app-shell .mobile-survey-form button[type=submit] { width: 100%; min-height: 50px; margin-top: 1rem !important; }

  .app-shell .profile-container { margin: 1rem; padding: 1.2rem; border-radius: 20px; box-shadow: none; border: 1px solid #e3ebed; }
  .app-shell .profile-title { font-size: 1.3rem; }
  .app-shell .profile-item { align-items: flex-start; gap: .75rem; flex-wrap: wrap; }
  .app-shell .profile-item-value { max-width: 100%; overflow-wrap: anywhere; }
  .app-shell .archive-item { border-radius: 18px !important; box-shadow: none !important; }
  .app-shell .archive-item h5 { font-size: .95rem; line-height: 1.6; }
  .app-shell .survey-results .results-header { border-radius: 20px; background: #edf5f4; }
  .app-shell .participant-detail, .app-shell .activity-page { padding: 18px 16px; }
  .app-shell .participant-chart-grid { grid-template-columns: none; grid-auto-flow: column; grid-auto-columns: calc(100% - 20px); overflow-x: auto; scroll-snap-type: x mandatory; gap: 12px; padding-bottom: 10px; }
  .app-shell .participant-chart-card { scroll-snap-align: start; border-radius: 18px; }
  .app-shell .participant-chart-canvas { height: 240px; }
  .app-shell .participant-actions .btn { font-size: .8rem; }
  .app-shell .participant-record-panel { width: 100% !important; }
  .app-shell .activity-filters { border-radius: 18px; background: white; }
  .app-shell .results-card { border-radius: 18px; }
  .app-shell .site-footer-divider { margin-top: 1rem; background: #e1e9eb; }
  .app-shell .site-footer { background: transparent; padding: 1rem 16px 1.5rem; }
  .app-shell .site-footer-inner { padding: 0; }
  .app-shell .site-footer a { display: inline-flex; align-items: center; min-height: 44px; }
  .app-shell .footer-main-row { font-size: .72rem; gap: .1rem; }
  .app-shell .footer-email { font-size: .75rem; }

  .app-shell.auth-shell .vh-100 { height: auto !important; min-height: calc(100svh - 155px); }
  .app-shell.auth-shell .login-wrapper { min-height: calc(100svh - 155px); padding: 16px; }
  .app-shell.auth-shell .login-card { border-radius: 24px; box-shadow: 0 6px 24px #26464d08; padding: 1.5rem; }
  .app-shell.auth-shell .login-logo { font-size: 1.8rem; }
  .app-shell.auth-shell .login-body { padding: 1rem .5rem; }
  .app-shell.auth-shell .login-subtext { margin-bottom: 1.5rem; }
}
