/* Koravik Health mobile-first experience. Desktop remains available, but phone UX is authoritative. */
.health-mobile-nav,.health-mobile-log,.health-mobile-more{display:none}

@media (max-width: 760px){
  html{scroll-padding-bottom:92px}
  body.health-shell{background:#f5f7f5;padding-bottom:calc(84px + env(safe-area-inset-bottom))}
  .health-shell .app-layout{display:block;min-height:100dvh;background:#f5f7f5}
  .health-shell .sidebar{display:none!important}
  .health-shell .app-main{display:block;width:100%;min-width:0;margin:0}

  /* Compact app bar built for one-handed use. */
  .health-shell .app-header{position:sticky;top:0;z-index:38;display:grid;grid-template-columns:auto 1fr auto;gap:10px;align-items:center;min-height:58px;padding:8px 12px;border-bottom:1px solid #dce4df;background:rgba(250,252,250,.96);backdrop-filter:blur(16px);-webkit-backdrop-filter:blur(16px)}
  .health-shell .app-header .mobile-logo-link{display:flex!important;width:34px;height:34px;align-items:center;overflow:hidden}
  .health-shell .app-header .mobile-logo-link .koravik-logo{width:auto;height:30px;max-width:none}
  .health-shell .app-header .search-label{display:none}
  .health-shell .app-header .header-actions{grid-column:3;display:flex;align-items:center;gap:6px}
  .health-shell .health-product-switcher{min-height:38px;padding:7px 10px;font-size:0;border-color:#d7e1da;background:#fff}
  .health-shell .health-product-switcher .health-product-pill{font-size:.7rem;margin:0}
  .health-shell .health-product-switcher span:last-child{display:none}
  .health-shell .app-header form[action*="sign-out"]{display:none}

  .health-shell .workspace{width:100%;max-width:none;margin:0;padding:14px 14px 26px}
  .health-shell .page-heading{margin:0 0 12px;padding:0}
  .health-shell .page-heading .eyebrow{display:none}
  .health-shell .page-heading h1{font-size:clamp(1.55rem,7vw,2rem);line-height:1.08;margin:0}

  /* Cards become touch surfaces, not desktop dashboard tiles. */
  .health-hero{display:grid;gap:14px;padding:16px;margin:0 0 14px;border-radius:18px}
  .health-hero>div:first-child{min-width:0}
  .health-hero h2{font-size:1.45rem;line-height:1.12;margin:2px 0 6px}
  .health-hero .health-subcopy{font-size:.9rem;line-height:1.45}
  .health-hero-score{display:flex;align-items:center;justify-content:space-between;gap:12px;min-width:0;padding:11px 13px;border-radius:14px;text-align:left}
  .health-hero-score span{font-size:1.7rem}
  .health-hero-score small{margin:0;max-width:180px;text-align:right}
  .health-needs{margin-top:10px;gap:6px}
  .health-insight-badge{min-height:32px;align-items:center;padding:6px 9px}

  .health-metric-grid{display:flex;gap:9px;margin:0 -14px 18px;padding:0 14px 2px;overflow-x:auto;scroll-snap-type:x proximity;-webkit-overflow-scrolling:touch;scrollbar-width:none}
  .health-metric-grid::-webkit-scrollbar{display:none}
  .health-metric-card{flex:0 0 min(72vw,245px);scroll-snap-align:start;padding:14px;border-radius:16px}
  .health-metric-head strong{font-size:1.55rem}

  .health-section{margin:18px 0}
  .health-section-head{align-items:flex-start;gap:8px;margin-bottom:10px}
  .health-section-head h2,.health-section-head h3{font-size:1.2rem}
  .health-section-head .action-row{gap:4px}
  .health-text-button,.health-section-head>a{min-height:40px;display:inline-flex;align-items:center;padding:8px 6px}

  /* Quick logging is deliberately thumb-sized and horizontally scannable. */
  .health-quick-grid{display:flex;gap:9px;margin:0 -14px;padding:0 14px 4px;overflow-x:auto;scroll-snap-type:x proximity;scrollbar-width:none}
  .health-quick-grid::-webkit-scrollbar{display:none}
  .health-quick-action{flex:0 0 118px;min-height:88px;padding:12px;border-radius:16px;scroll-snap-align:start}
  .health-quick-action span{font-size:1.45rem}
  .health-quick-action strong{font-size:.9rem;line-height:1.15}

  .health-two-column,.gi-overview-grid,.health-form-grid,.health-choice-grid,.health-choice-grid.two{grid-template-columns:1fr!important}
  .health-panel{padding:14px;border-radius:16px}
  .health-two-column{gap:12px}
  .health-timeline-row{grid-template-columns:72px minmax(0,1fr);gap:10px;padding:11px 0}
  .health-timeline-row time{font-size:.76rem}
  .health-habit-row{min-height:48px}
  .health-check{width:32px;height:32px;flex:0 0 32px}

  /* Nutrition is a diary on phone, not a five-column spreadsheet. */
  .nutrition-toolbar{display:grid!important;grid-template-columns:1fr!important;gap:10px!important;align-items:start!important}
  .nutrition-toolbar-actions{display:flex!important;gap:7px!important;overflow-x:auto;padding-bottom:2px;scrollbar-width:none}
  .nutrition-toolbar-actions::-webkit-scrollbar{display:none}
  .nutrition-toolbar-actions .button{min-height:44px;white-space:nowrap}
  .nutrition-strip{display:flex!important;gap:8px!important;margin:0 -14px 14px!important;padding:0 14px 2px!important;overflow-x:auto;scroll-snap-type:x proximity;scrollbar-width:none}
  .nutrition-strip::-webkit-scrollbar{display:none}
  .nutrition-strip>div{flex:0 0 112px;min-height:78px;padding:11px!important;border-radius:14px;scroll-snap-align:start}
  .nutrition-log-head{display:none!important}
  .nutrition-meal-group{border-radius:16px!important;overflow:hidden;margin-bottom:12px}
  .nutrition-meal-head{display:grid!important;grid-template-columns:minmax(0,1fr) auto!important;gap:4px 8px!important;padding:12px!important}
  .nutrition-meal-head>button{grid-column:2;grid-row:1 / span 2;align-self:center;min-height:42px;padding:8px 10px}
  .nutrition-food-row{display:grid!important;grid-template-columns:minmax(0,1fr) auto!important;gap:3px 10px!important;padding:12px!important;min-height:64px;align-items:center}
  .nutrition-food-name{grid-column:1;grid-row:1;font-size:.95rem;white-space:normal!important;overflow:visible!important;text-overflow:clip!important}
  .nutrition-food-row>span:nth-of-type(1){grid-column:1;grid-row:2;font-size:.78rem;color:#69766e}
  .nutrition-inline-tags{display:none!important}
  .nutrition-kcal{grid-column:2;grid-row:1;font-size:.92rem}
  .nutrition-row-action{grid-column:2;grid-row:2;width:40px;height:34px;justify-self:end}
  .nutrition-empty-row{min-height:58px;padding:12px!important}
  .saved-meal-grid{grid-template-columns:1fr!important}
  .saved-meal-card{padding:13px!important}

  /* Drawers become bottom sheets: familiar, reachable, and keyboard-safe. */
  .health-modal{z-index:70}
  .health-modal-backdrop{background:rgba(12,28,23,.5)}
  .health-modal-panel,.health-modal-panel.wide{top:auto!important;right:0!important;left:0!important;bottom:0!important;width:100%!important;max-width:none!important;max-height:92dvh;border-radius:22px 22px 0 0;padding:16px 14px calc(18px + env(safe-area-inset-bottom));box-shadow:0 -18px 44px rgba(20,45,36,.2)}
  .health-modal-panel>header{position:sticky;top:-16px;z-index:2;margin:-16px -14px 12px;padding:14px;background:#fff;border-radius:22px 22px 0 0;border-bottom:1px solid #edf1ee}
  .health-modal-panel>header button{width:44px;height:44px;flex:0 0 44px}
  .health-form-stack label,.health-modal label{font-size:.9rem}
  .health-form-stack input,.health-form-stack select,.health-form-stack textarea,.health-modal input,.health-modal select,.health-modal textarea{min-height:48px;font-size:16px}
  .health-form-stack .button,.health-modal .button{min-height:48px}
  .food-source-tabs{display:flex!important;overflow-x:auto;gap:5px;scrollbar-width:none}
  .food-source-tabs::-webkit-scrollbar{display:none}
  .food-source-tabs button{min-height:42px;white-space:nowrap}
  .recent-food-list button,.saved-meal-modal-list button{min-height:56px}

  .bristol-grid,.bristol-grid.compact{display:flex!important;gap:8px;overflow-x:auto;padding:2px 1px 8px;scroll-snap-type:x proximity;scrollbar-width:none}
  .bristol-grid::-webkit-scrollbar,.bristol-grid.compact::-webkit-scrollbar{display:none}
  .bristol-card{flex:0 0 118px;min-height:126px;scroll-snap-align:start}

  /* Module-specific phone hardening. */
  .activity-hero .health-hero-actions,.vitals-hero .health-hero-actions{width:100%}
  .activity-hero .health-hero-actions .button,.vitals-hero .health-hero-actions .button{width:100%;justify-content:center}
  .activity-history-row,.weight-history-row,.vitals-history-row{min-height:64px!important;padding:11px 12px!important;border-radius:13px!important}
  .activity-history-metrics{min-height:40px}
  .activity-set-table{grid-template-columns:42px minmax(0,1fr) minmax(0,1fr)!important;overflow:hidden}
  .strength-set-row{padding:9px!important;border-radius:12px!important}
  .weight-real-chart{margin-left:-4px;margin-right:-4px;padding:8px!important;min-height:190px!important}
  .weight-real-chart svg{height:160px!important}
  .habit-category-strip{display:flex!important;gap:8px;overflow-x:auto;scrollbar-width:none}
  .habit-category-strip::-webkit-scrollbar{display:none}
  .habit-category-chip{flex:0 0 min(74vw,260px);min-height:58px}
  .habit-row-v2{min-height:68px;padding:10px!important}
  .habit-progress-button{width:48px!important;height:48px!important}
  .vital-pref-list label{min-height:52px}
  .health-connected-grid,.health-reminder-grid,.health-template-grid,.health-data-grid,.health-onboarding-grid{grid-template-columns:1fr!important;gap:10px!important}
  .health-connection-card,.health-reminder-card,.health-template-card,.health-data-card,.onboarding-card{padding:13px!important;border-radius:16px!important}
  .health-connection-card header,.health-reminder-card header,.health-template-card header{gap:8px!important}
  .health-sync-table,.health-data-table{display:block!important;width:100%;overflow-x:auto;-webkit-overflow-scrolling:touch}
  .health-sync-table th,.health-sync-table td,.health-data-table th,.health-data-table td{white-space:nowrap;padding:9px!important;font-size:.78rem!important}
  .health-template-exercise{min-height:48px;align-items:center}
  .health-danger-zone{padding:14px!important;border-radius:16px!important}
  .rest-timer{flex-wrap:wrap}

  /* Calendar remains usable without microscopic tap targets. */
  .health-calendar-grid{gap:3px!important}
  .health-calendar-weekday{font-size:.64rem;padding:3px;text-align:center}
  .health-calendar-day{min-height:54px!important;padding:6px 4px!important;border-radius:10px!important;text-align:center}
  .health-calendar-day strong{font-size:.86rem}
  .health-calendar-day span{display:none}

  /* General touch/accessibility hardening. */
  .health-shell button,.health-shell .button,.health-shell select,.health-shell input[type="checkbox"],.health-shell input[type="radio"]{touch-action:manipulation}
  .health-shell .button:not(.button-small){min-height:48px}
  .health-shell .button-small{min-height:42px}
  .health-shell input:not([type="checkbox"]):not([type="radio"]),.health-shell select,.health-shell textarea{font-size:16px}
  .health-shell details>summary{min-height:44px;display:flex;align-items:center;cursor:pointer}
  .provider-summary-grid,.health-goal-grid{grid-template-columns:1fr!important}

  /* Native mobile navigation. */
  .health-mobile-nav{position:fixed;z-index:60;left:0;right:0;bottom:0;display:grid;grid-template-columns:repeat(5,1fr);height:calc(68px + env(safe-area-inset-bottom));padding:4px 6px env(safe-area-inset-bottom);border-top:1px solid #d6e0da;background:rgba(255,255,255,.97);box-shadow:0 -8px 28px rgba(24,58,49,.1);backdrop-filter:blur(16px);-webkit-backdrop-filter:blur(16px)}
  .health-mobile-nav>a,.health-mobile-nav>button{appearance:none;border:0;background:transparent;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:2px;min-width:0;padding:4px 2px;color:#617068;text-decoration:none;font:700 .66rem/1.05 system-ui,-apple-system,sans-serif;cursor:pointer}
  .health-mobile-nav .mobile-nav-icon{display:grid;place-items:center;width:28px;height:26px;border-radius:9px;font-size:1.15rem;line-height:1;color:#315f4f}
  .health-mobile-nav>a.active,.health-mobile-nav>button.active{color:#173d36}
  .health-mobile-nav>a.active .mobile-nav-icon,.health-mobile-nav>button.active .mobile-nav-icon{background:#e3f0e8;color:#173d36}
  .health-mobile-nav .mobile-log-trigger .mobile-nav-icon{width:42px;height:42px;margin-top:-20px;border-radius:50%;background:#173d36!important;color:#fff!important;font-size:1.5rem;box-shadow:0 5px 14px rgba(23,61,54,.24)}

  .health-mobile-log,.health-mobile-more{position:fixed;z-index:65;left:10px;right:10px;bottom:calc(76px + env(safe-area-inset-bottom));margin:0}
  .health-mobile-log[open],.health-mobile-more[open]{display:block}
  .health-mobile-log>summary,.health-mobile-more>summary{display:none}
  .health-mobile-sheet{padding:12px;border:1px solid #d8e2dc;border-radius:20px;background:#fff;box-shadow:0 14px 48px rgba(20,45,36,.24)}
  .health-mobile-sheet-head{display:flex;justify-content:space-between;align-items:center;padding:4px 4px 10px}
  .health-mobile-sheet-head strong{font-size:1rem;color:#173d36}
  .health-mobile-sheet-close{border:0;background:#eef4f0;border-radius:50%;width:36px;height:36px;font-size:1.2rem}
  .health-mobile-sheet-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:8px}
  .health-mobile-sheet-grid form{display:contents}
  .health-mobile-sheet-grid a,.health-mobile-sheet-grid form>button{appearance:none;display:grid;place-items:center;gap:6px;min-height:76px;padding:9px 6px;border:1px solid #e0e7e2;border-radius:14px;background:#fbfdfc;color:#173d36;text-decoration:none;text-align:center;font:800 .74rem/1.15 system-ui,-apple-system,sans-serif;cursor:pointer}
  .health-mobile-sheet-grid a span,.health-mobile-sheet-grid form>button span{font-size:1.25rem}
  .health-mobile-more .health-mobile-sheet-grid{grid-template-columns:repeat(3,minmax(0,1fr));max-height:52dvh;overflow:auto}
  .health-mobile-sheet-grid form>button.health-mobile-signout{color:#7a3434;background:#fffafa;border-color:#ead7d7}
}

@media (max-width: 390px){
  .health-shell .workspace{padding-left:11px;padding-right:11px}
  .health-metric-grid,.health-quick-grid,.nutrition-strip{margin-left:-11px;margin-right:-11px;padding-left:11px;padding-right:11px}
  .health-mobile-nav{padding-left:2px;padding-right:2px}
  .health-mobile-nav>a,.health-mobile-nav>button{font-size:.61rem}
  .health-mobile-sheet-grid,.health-mobile-more .health-mobile-sheet-grid{grid-template-columns:repeat(3,1fr);gap:6px}
}