
  @media (max-width: 768px) {
    /* flatten the hero wrappers so fixed layers align to the viewport */
    html.ta-mapapp, html.ta-mapapp body { height: 100%; }
    body.ta-mapapp { overflow: hidden; }
    body.ta-mapapp .tmp-field:not(.tmp-wide) { flex: 1 1 0; min-width: 0; }
    body.ta-mapapp .tmp-field input, body.ta-mapapp .tmp-field select { width: 100%; min-width: 0; box-sizing: border-box; }
    body.ta-mapapp .tmp-sheet-head { min-width: 0; }
    body.ta-mapapp .tmp-sheet-head .t, body.ta-mapapp .tmp-sheet-head .s { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .ai-home-wrap, .ai-home-wrap .content { padding: 0 !important; margin: 0 !important; min-height: 0 !important; background: transparent !important; overflow: visible !important; }
    .ai-home-wrap .content > h1, .ai-home-wrap .content > p.lead { display: none !important; }
    .ai-home-wrap .ta-hp { display: none !important; } /* product carousel -> now under Discover tab */

    /* the planner shell collapses; its children are positioned as floating layers */
    .tmp-host { margin: 0 !important; }
    .tmp-wrap { background: none !important; border: none !important; box-shadow: none !important; padding: 0 !important; max-width: none !important; margin: 0 !important; }
    .tmp-head { display: none !important; }
    .tmp-hint { display: none !important; }

    /* FULL-SCREEN MAP */
    #tmpMap.tmp-map {
      position: fixed !important; inset: 0 !important; top: 0 !important; left: 0 !important;
      width: 100% !important; height: 100% !important; height: 100dvh !important;
      border: none !important; border-radius: 0 !important; z-index: 1 !important;
    }
    .leaflet-control-zoom { display: none !important; }
    .leaflet-bottom.leaflet-right { margin-bottom: calc(64px + env(safe-area-inset-bottom)); }
    .tmp-map .ta-eyebtn { bottom: calc(128px + env(safe-area-inset-bottom)); right: 12px; }

    /* FLOATING TOP TOOLBAR — compact icon + short label pill */
    .tmp-toolbar {
      position: fixed !important; top: 60px; left: 10px; right: auto; z-index: 500;
      display: flex; flex-wrap: nowrap; gap: 5px; align-items: center;
      background: rgba(255,255,255,.96); backdrop-filter: blur(8px);
      border-radius: 999px; padding: 5px 8px; margin: 0 !important;
      box-shadow: 0 6px 22px rgba(0,0,0,.16); max-width: calc(100% - 20px); overflow-x: auto; scrollbar-width: none;
    }
    .tmp-toolbar::-webkit-scrollbar { display: none; }
    .tmp-btn { flex: 0 0 auto; padding: 8px 12px; border-radius: 999px; font-size: 12.5px; font-weight: 700; line-height: 1; border-width: 0; background: #f1f3f2; color: #47524e; display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; }
    .tmp-btn:hover { border-color: transparent; }
    .tmp-mode.active { background: #e8451c; color: #fff; }
    .tmp-sep { flex: 0 0 auto; width: 1px; height: 22px; background: #e3e7e5; margin: 0 1px; }
    .tmp-count { flex: 0 0 auto; margin-left: 4px !important; padding: 6px 10px; border-radius: 999px; background: #eafaf2; color: #0a7a4a; font-weight: 800; font-size: 12.5px; white-space: nowrap; }
    .tmp-more-btn { padding: 8px 12px; font-weight: 800; letter-spacing: 1px; }
    .tmp-more-btn.active { background: #e8451c; color: #fff; }
    .tmp-more-menu { position: fixed; z-index: 501; display: none; flex-direction: column; gap: 4px; background: #fff; border: 1px solid #eef0ef; border-radius: 14px; box-shadow: 0 10px 30px rgba(0,0,0,.18); padding: 6px; width: 150px; }
    .tmp-more-menu.open { display: flex; }
    .tmp-more-menu .tmp-btn { width: 100%; justify-content: flex-start; border-radius: 10px; background: #f7f9f8; padding: 11px 12px; font-size: 13px; }
    .tmp-more-menu .tmp-btn:hover { background: #eef4f1; }

    /* FLOATING STOPS CHIPS */
    .tmp-stops {
      position: fixed !important; top: 108px; left: 10px; right: 10px; z-index: 499;
      display: flex; flex-wrap: nowrap; gap: 8px; margin: 0 !important;
      overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; padding: 1px 0;
    }
    .tmp-stops::-webkit-scrollbar { display: none; }
    .tmp-chip { flex: 0 0 auto; box-shadow: 0 3px 10px rgba(0,0,0,.12); border-color: #fff; }
    .tmp-stops:empty { display: none; }
    /* ROUTE STATS — compact line tucked under the stop chips (same cluster) */
    .tmp-rstats {
      position: fixed !important; top: 142px; left: 10px; right: auto; width: auto; z-index: 499; margin: 0 !important;
      display: inline-flex; align-items: center; gap: 5px; text-align: left; padding: 5px 11px; font-size: 12px; font-weight: 800; color: #0a7a4a;
      background: #fff; border: 1px solid #eef0ef; border-radius: 999px; box-shadow: 0 2px 8px rgba(0,0,0,.10);
    }

    /* BOTTOM SHEET (trip form + actions) */
    .tmp-sheet {
      position: fixed; left: 0; right: 0; bottom: 0; z-index: 600;
      background: #fff; border-radius: 20px 20px 0 0;
      box-shadow: 0 -8px 30px rgba(0,0,0,.18);
      padding-bottom: calc(64px + env(safe-area-inset-bottom));
      max-height: 62vh; display: flex; flex-direction: column; overflow: hidden;
      transition: max-height .32s ease, padding-bottom .32s ease;
    }
    .tmp-sheet-grab { display: flex; align-items: center; gap: 10px; padding: 10px 16px 6px; flex: 0 0 auto; cursor: pointer; touch-action: none; }
    .tmp-sheet-grab .grip { width: 40px; height: 4px; border-radius: 3px; background: #dfe4e2; margin: 0 auto; }
    .tmp-sheet-head { display: flex; align-items: center; gap: 10px; padding: 2px 16px 10px; border-bottom: 1px solid #f0f2f1; flex: 0 0 auto; }
    .tmp-sheet-head .t { font-size: 15px; font-weight: 800; color: #1c1c1c; }
    .tmp-sheet-head .s { font-size: 12px; color: #93a09b; margin-left: auto; font-weight: 600; }
    .tmp-sheet-head .chev { border: none; background: #f1f3f2; color: #47524e; width: 30px; height: 30px; border-radius: 50%; font-size: 16px; cursor: pointer; }
    .tmp-sheet-body { overflow-y: auto; overflow-x: hidden; -webkit-overflow-scrolling: touch; padding: 4px 14px 14px; flex: 1 1 auto; min-height: 0; }
    .tmp-sheet.collapsed { max-height: 0; padding-bottom: 0; }
    /* collapsed floating handle */
    .tmp-sheet-handle {
      position: fixed; left: 0; right: 0; bottom: calc(60px + env(safe-area-inset-bottom)); z-index: 601;
      display: none; flex-direction: column; align-items: center; gap: 5px; width: auto;
      background: #fff; color: #47524e; border: none; border-top: 1px solid #ececec; border-radius: 16px 16px 0 0;
      box-shadow: 0 -4px 18px rgba(0,0,0,.08); padding: 8px 14px 11px; font-size: 13.5px; font-weight: 800; cursor: pointer;
      -webkit-tap-highlight-color: transparent; touch-action: none;
    }
    .tmp-sheet-handle .grip { width: 42px; height: 4px; border-radius: 3px; background: #cfd6d3; }
    .tmp-sheet.collapsed ~ .tmp-sheet-handle { display: flex; }
    .tmp-row { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 12px; }
    .tmp-field { flex: 1 1 30%; min-width: 92px; }
    .tmp-wide { flex-basis: 100%; min-width: 0; }
    .tmp-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 14px; }
    .tmp-go { flex: 1 1 100%; padding: 14px; font-size: 15px; }
    body.ta-mapapp .tmp-export { flex: 1 1 100%; order: -2; padding: 14px; font-size: 15px; font-weight: 800; background: linear-gradient(135deg,#f2571f,#e8451c); color: #fff; border-color: transparent; box-shadow: 0 4px 14px rgba(232,69,28,.28); }
    body.ta-mapapp .tmp-export:hover, body.ta-mapapp .tmp-export:active { background: linear-gradient(135deg,#f2571f,#e8451c); color: #fff; }
    body.ta-mapapp .tmp-export:disabled { opacity: .85; }
    body.ta-mapapp .tmp-export-tip { order: -1; }
    .tmp-human { flex: 1 1 100%; padding: 12px; }
    .tmp-chat-open { flex: 1 1 100%; margin-top: 2px; padding: 12px; border: 1.5px solid #00aa6c; border-radius: 999px; background: #eafaf2; color: #0a7a4a; font-size: 14px; font-weight: 800; cursor: pointer; }
    .tmp-result { max-height: 40vh; overflow-y: auto; }

    /* preview trigger lives in the top toolbar */
    .tmp-toolbar .tmp-pv-top { flex: 0 0 auto; padding: 8px 12px; font-size: 12.5px; font-weight: 800; border-radius: 999px; border: 1.5px solid #e8451c; background: #fff; color: #e8451c; }
    /* top-docked route preview panel (always visible when shown, not collapsed) */
    .tmp-rt { position: fixed; top: 152px; left: 10px; right: 10px; z-index: 649; background: #fff; border-radius: 14px; box-shadow: 0 10px 30px rgba(0,0,0,.2); padding: 12px 14px; max-height: 42vh; overflow-y: auto; display: none; }
    .tmp-rt.show { display: block; }
    .tmp-rt-head { display: flex; align-items: center; font-size: 14px; font-weight: 800; color: #1c1c1c; margin-bottom: 8px; }
    .tmp-rt-head .tmp-rt-x { margin-left: auto; border: none; background: #f1f3f2; color: #47524e; width: 26px; height: 26px; border-radius: 50%; font-size: 16px; line-height: 1; cursor: pointer; }
    .tmp-rt-body .tmp-sum-list { margin: 0 0 8px; padding-left: 20px; }
    .tmp-rt-body .tmp-sum-list li { font-size: 13.5px; margin: 3px 0; }
    .tmp-rt-body .tmp-sum-list b { color: #00aa6c; margin-right: 4px; }
    .tmp-rt-body .tmp-sum-meta { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 6px; }
    .tmp-rt-body .tmp-sum-meta span { font-size: 11.5px; background: #eef7f2; color: #0a7a4a; font-weight: 700; padding: 4px 9px; border-radius: 999px; }
    .tmp-rt-body .tmp-sum-tip { font-size: 12px; color: #777; }

    /* CHAT RIGHT DRAWER + edge handle + hint */
    .tmp-chat-scrim { position: fixed; inset: 0; z-index: 100000; background: rgba(0,0,0,.35); opacity: 0; pointer-events: none; transition: opacity .28s; }
    .tmp-chat-scrim.show { opacity: 1; pointer-events: auto; }
    .tmp-chat-sheet {
      position: fixed; top: 0; right: 0; bottom: 0; z-index: 100001; width: 88vw; max-width: 420px;
      background: #fff; display: flex; flex-direction: column;
      transform: translateX(100%); transition: transform .3s cubic-bezier(.22,.61,.36,1);
      box-shadow: -10px 0 40px rgba(0,0,0,.25); will-change: transform;
    }
    .tmp-chat-sheet.open { transform: translateX(0); }
    .tmp-chat-edge { position: absolute; left: -16px; top: 0; bottom: 0; width: 20px; }
    .tmp-chat-top { display: flex; align-items: center; gap: 10px; padding: calc(10px + env(safe-area-inset-top)) 14px 12px; background: #fff; color: #2f3a3f; border-bottom: 1px solid #ececec; }
    .tmp-chat-top .ct { font-size: 16px; font-weight: 800; }
    .tmp-chat-top .cc { margin-left: auto; border: none; background: rgba(0,0,0,.06); color: #2f3a3f; width: 32px; height: 32px; border-radius: 50%; font-size: 18px; line-height: 1; cursor: pointer; }
    .tmp-chat-host { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; padding: 10px; }
    .tmp-chat-handle { position: fixed; right: 0; top: 42%; z-index: 900; display: flex; flex-direction: column; align-items: center; gap: 1px; width: 42px; padding: 14px 0 14px 8px; background: linear-gradient(135deg,#7c8883,#5b6560); color: #fff; border-radius: 14px 0 0 14px; box-shadow: -3px 5px 16px rgba(0,0,0,.28); cursor: pointer; -webkit-tap-highlight-color: transparent; }
    .tmp-chat-handle .ico { font-size: 18px; }
    .tmp-chat-handle .lbl { font-size: 10.5px; font-weight: 800; letter-spacing: .5px; }
    .tmp-chat-handle .arw { font-size: 13px; opacity: .9; }
    .tmp-chat-handle.hidden { display: none; }
    .tmp-chat-hint { position: fixed; right: 50px; top: 42%; z-index: 899; background: rgba(28,28,28,.92); color: #fff; font-size: 12px; font-weight: 700; padding: 8px 12px; border-radius: 12px; box-shadow: 0 6px 18px rgba(0,0,0,.28); white-space: nowrap; animation: taHint 1.6s ease-in-out infinite; }
    .tmp-chat-hint::after { content: ''; position: absolute; right: -6px; top: 50%; transform: translateY(-50%); border: 6px solid transparent; border-left-color: rgba(28,28,28,.92); }
    @keyframes taHint { 0%,100% { transform: translate(0,0); } 50% { transform: translate(-7px,0); } }
    /* chat fills the drawer, input pinned to bottom */
    .tmp-chat-host .mwai-chatbot-container { margin: 0 !important; border-radius: 12px !important; flex: 1 1 auto !important; min-height: 0 !important; height: auto !important; display: flex !important; flex-direction: column !important; box-shadow: 0 4px 18px rgba(0,0,0,.08) !important; }
    .tmp-chat-host .mwai-chatbot-container > div,
    .tmp-chat-host .mwai-chat { flex: 1 1 auto !important; min-height: 0 !important; width: 100%; display: flex !important; flex-direction: column !important; }
    .tmp-chat-host .mwai-window-box { flex: 1 1 auto !important; min-height: 0 !important; height: auto !important; display: flex !important; flex-direction: column !important; }
    .tmp-chat-host .mwai-body { flex: 1 1 auto !important; min-height: 0 !important; height: auto !important; display: flex !important; flex-direction: column !important; }
    .tmp-chat-host .mwai-conversation { flex: 1 1 auto !important; min-height: 0 !important; height: auto !important; max-height: none !important; overflow-y: auto !important; padding: 6px 6px 2px; }
    .tmp-chat-host .mwai-input { flex: 0 0 auto !important; position: static !important; left: auto; right: auto; bottom: auto; margin-top: 0 !important; }
  }
  