/* Central Orbit v5.50.32 — Mobile polish + cookbook recovery
   Intent: touch ergonomics, readable controls and reliable recipe browsing.
   Desktop is intentionally untouched. */
@media (max-width: 820px) {
  :root { --co-mobile-hit: 46px; }

  /* Global touch/readability polish */
  html body.co-module-runtime .primary-button,
  html body.co-module-runtime .secondary-button,
  html body.co-module-runtime .ghost-button,
  html body.co-module-runtime .danger-button,
  html body.co-module-runtime button.recipe-tab,
  html body.co-module-runtime .settings-v2-navigation button {
    min-height: 46px !important;
    font-size: 14px !important;
    line-height: 1.15 !important;
    padding-top: 10px !important;
    padding-bottom: 10px !important;
  }
  html body.co-module-runtime .icon-button {
    min-width: 44px !important;
    min-height: 44px !important;
  }
  html body.co-module-runtime .card-header p,
  html body.co-module-runtime .muted,
  html body.co-module-runtime .empty-state { line-height: 1.45 !important; }

  body .mobile-bottom-nav small { font-size: 11px !important; }
  body .mobile-all-grid { grid-template-columns: repeat(3,minmax(0,1fr)) !important; gap: 8px !important; }
  body .mobile-all-grid a { min-height: 78px !important; padding: 9px 6px !important; }
  body .mobile-all-grid span { font-size: 11px !important; line-height: 1.15 !important; }

  /* Shopping: thumb-first instead of tiny desktop controls. */
  html body.co-module-runtime .shopping-quick-row {
    grid-template-columns: 1fr 1fr !important;
    gap: 8px !important;
  }
  html body.co-module-runtime .shopping-quick-row > input {
    grid-column: 1 / -1 !important;
    min-height: 50px !important;
  }
  html body.co-module-runtime .shopping-quick-row > button {
    width: 100% !important;
    min-height: 48px !important;
  }
  html body.co-module-runtime .shopping-item {
    display: grid !important;
    grid-template-columns: 50px minmax(0,1fr) !important;
    gap: 9px !important;
    align-items: center !important;
    padding: 11px !important;
  }
  html body.co-module-runtime .shopping-check {
    grid-column: 1 !important;
    width: 48px !important;
    height: 48px !important;
    min-width: 48px !important;
    min-height: 48px !important;
    border-radius: 15px !important;
    font-size: 18px !important;
  }
  html body.co-module-runtime .shopping-item-main { grid-column: 2 !important; }
  html body.co-module-runtime .shopping-item-main strong { font-size: 16px !important; line-height: 1.2 !important; }
  html body.co-module-runtime .shopping-item-main p { margin-top: 4px !important; font-size: 13px !important; }
  html body.co-module-runtime .shopping-actions {
    grid-column: 1 / -1 !important;
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    width: 100% !important;
    gap: 8px !important;
  }
  html body.co-module-runtime .shopping-actions > button { width: 100% !important; min-height: 44px !important; }
  html body.co-module-runtime .shopping-edit-form { grid-template-columns: 1fr !important; }
  html body.co-module-runtime .shopping-edit-form .shopping-check { display: none !important; }
  html body.co-module-runtime .shopping-edit-grid { grid-column: 1/-1 !important; }

  /* Cookbook list: the previous rule only assigned grid columns to a flex card,
     so recipe previews never formed a usable mobile selection row. */
  html body.co-module-runtime .recipe-grid.compact {
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: 10px !important;
  }
  html body.co-module-runtime .recipe-card.compact {
    display: grid !important;
    grid-template-columns: 118px minmax(0,1fr) !important;
    min-height: 142px !important;
    width: 100% !important;
    overflow: hidden !important;
    border-radius: 16px !important;
  }
  html body.co-module-runtime .recipe-card.compact .recipe-image {
    grid-column: 1 !important;
    width: 118px !important;
    height: 100% !important;
    min-height: 142px !important;
    max-height: none !important;
    align-self: stretch !important;
  }
  html body.co-module-runtime .recipe-card.compact .recipe-body {
    grid-column: 2 !important;
    min-width: 0 !important;
    padding: 11px !important;
    gap: 7px !important;
    justify-content: space-between !important;
  }
  html body.co-module-runtime .recipe-card.compact h3 {
    margin: 5px 0 2px !important;
    font-size: 17px !important;
    line-height: 1.15 !important;
    overflow-wrap: anywhere !important;
  }
  html body.co-module-runtime .recipe-card.compact p { font-size: 13px !important; line-height: 1.35 !important; }
  html body.co-module-runtime .recipe-card.compact .button-row {
    display: grid !important;
    grid-template-columns: 1fr 1fr 46px !important;
    gap: 6px !important;
    width: 100% !important;
  }
  html body.co-module-runtime .recipe-card.compact .button-row > button {
    min-width: 0 !important;
    width: 100% !important;
    min-height: 42px !important;
    padding: 8px !important;
    font-size: 12px !important;
  }
  html body.co-module-runtime .recipe-toolbar .pill { align-self: flex-start !important; }
  html body.co-module-runtime .recipe-tab { flex: 0 0 auto !important; }
  html body.co-module-runtime .recipe-detail-meta { grid-template-columns: 1fr 1fr !important; gap: 8px !important; }
  html body.co-module-runtime .recipe-meta-tile:last-child { grid-column: 1/-1 !important; }
  html body.co-module-runtime .recipe-detail-section { padding: 13px !important; }
  html body.co-module-runtime .recipe-list { padding-left: 22px !important; }
  html body.co-module-runtime .recipe-list li { margin: 9px 0 !important; font-size: 15px !important; line-height: 1.45 !important; }
  html body.co-module-runtime .recipe-transfer-dialog { padding-bottom: env(safe-area-inset-bottom) !important; }

  /* Settings: keep navigation reachable and content constrained to viewport. */
  html body.co-module-runtime .settings-v2-shell,
  html body.co-module-runtime .settings-v2-main,
  html body.co-module-runtime .settings-v2-sidebar,
  html body.co-module-runtime .settings-v2-main > * { min-width: 0 !important; max-width: 100% !important; }
  html body.co-module-runtime .settings-v2-navigation {
    margin: 0 -2px !important;
    padding: 2px 2px 7px !important;
    scroll-snap-type: x proximity !important;
  }
  html body.co-module-runtime .settings-v2-navigation button {
    scroll-snap-align: start !important;
    padding-left: 14px !important;
    padding-right: 14px !important;
  }
  html body.co-module-runtime .settings-v2-main { overflow: visible !important; }
  html body.co-module-runtime .settings-v2-card,
  html body.co-module-runtime .settings-v2-section,
  html body.co-module-runtime .settings-v2-panel { overflow-wrap: anywhere !important; }

  /* Slightly too-small tabs from the first pass. */
  html body.co-module-runtime .relationship-tabs button { min-height: 42px !important; font-size: 12px !important; }
  html body.co-module-runtime .relationship-card > header button { min-height: 42px !important; font-size: 12px !important; }
  html body.co-module-runtime #fitnessControlCenterV2 .fitness-cc-tab-v2 { min-height: 44px !important; }

  /* Tables and wide admin rows remain usable without widening the whole page. */
  html body.co-module-runtime .settings-v2-main [class*="table"],
  html body.co-module-runtime .card [class*="table"] {
    max-width: 100% !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
  }
}

@media (max-width: 430px) {
  html body.co-module-runtime .recipe-card.compact { grid-template-columns: 104px minmax(0,1fr) !important; }
  html body.co-module-runtime .recipe-card.compact .recipe-image { width: 104px !important; }
  html body.co-module-runtime .recipe-card.compact .recipe-body { padding: 10px !important; }
  html body.co-module-runtime .recipe-card.compact .button-row { grid-template-columns: 1fr 44px !important; }
  html body.co-module-runtime .recipe-card.compact .button-row > button:nth-child(2) { display: none !important; }
}
