    :root { --tn-blue: #0b57d0; --tn-blue-weak: #ffffff; --tn-ink: #0b2d6b; --tn-header-bottom: 0px; --tn-map-top: 0px; --tn-header-h: 0px; --tn-tabs-h: 0px; --tn-panel-h: 44vh; --tn-panel-w: 380px; --tn-edge: 12px; --tn-font: Inter, "Noto Sans", "Noto Sans CJK KR", "Noto Sans CJK SC", "Noto Sans CJK TC", "Malgun Gothic", "Microsoft YaHei", "PingFang SC", "Segoe UI", Arial, sans-serif; --tn-base-font-size:16px; }

    /* Ensure consistent sizing (prevents 100% width + padding overflow on mobile) */
    *, *::before, *::after { box-sizing: border-box; }

    html, body { height: 100%; width: 100%; margin: 0; overflow: hidden; overscroll-behavior: none; background: #f2f3f5; font-family: var(--tn-font); color: var(--tn-ink); }
    #app { height: 100%; width: 100%; overflow: hidden; }
    #map { position: fixed; inset: 0; width: 100vw; height: 100vh; z-index: 0; background: #e9ecef;
      --tn-label-font: 16px;
      --tn-label-pad: 6px;
      --tn-label-radius: 6px;
    }

    /* Mobile: map starts BELOW the search box (header is above). */
    @media (max-width: 600px) {
  #map { top: var(--tn-map-top); height: calc(100vh - var(--tn-map-top)); }
}

    /*
      Leaflet CSS fallback (minimal)
      - Some environments intermittently fail to load leaflet.css from CDN, causing a blank map.
      - We embed essential Leaflet layout rules so the map still renders even when CDN CSS fails.
    */
    .leaflet-container { background: transparent; outline: 0; }
    #map,
    .leaflet-container,
    .leaflet-map-pane,
    .leaflet-tile-pane,
    .leaflet-overlay-pane,
    .leaflet-marker-pane {
      will-change: transform;
      backface-visibility: hidden;
      transform: translateZ(0);
    }
    .leaflet-container { position: relative; overflow: hidden; }
    .leaflet-pane,
    .leaflet-tile,
    .leaflet-marker-icon,
    .leaflet-marker-shadow,
    .leaflet-tile-container,
    .leaflet-overlay-pane,
    .leaflet-shadow-pane,
    .leaflet-marker-pane,
    .leaflet-tooltip-pane,
    .leaflet-popup-pane,
    .leaflet-map-pane,
    .leaflet-tile-pane,
    .leaflet-control-container {
      position: absolute;
      left: 0;
      top: 0;
    }
    .leaflet-tile,
    .leaflet-marker-icon,
    .leaflet-marker-shadow {
      -webkit-user-select: none;
      -moz-user-select: none;
      user-select: none;
      -webkit-user-drag: none;
    }
    .leaflet-tile { position: absolute; left: 0; top: 0; max-width: none !important; max-height: none !important; }
    .leaflet-top { position: absolute; top: 0; }
    .leaflet-bottom { position: absolute; bottom: 0; }
    .leaflet-left { position: absolute; left: 0; }
    .leaflet-right { position: absolute; right: 0; }
    .leaflet-control { position: relative; z-index: 800; pointer-events: auto; float: left; clear: both; }
    /* Leave space for the bottom sheet so controls do not overlap UI (mobile only) */
    @media (max-width: 1024px) {
      .leaflet-bottom.leaflet-left .leaflet-control { margin-left: 12px; margin-bottom: calc(var(--tn-panel-h) + 12px); }
      .leaflet-bottom.leaflet-right .leaflet-control { margin-right: 12px; margin-bottom: calc(var(--tn-panel-h) + 12px); }
    }
    .leaflet-bar { box-shadow: 0 1px 5px rgba(0,0,0,0.25); border-radius: 4px; }
    .leaflet-bar a,
    .leaflet-bar a:hover {
      background-color: #fff;
      border-bottom: 1px solid #ccc;
      width: 30px;
      height: 30px;
      line-height: 30px;
      display: block;
      text-align: center;
      text-decoration: none;
      color: #000;
      font-weight: 800;
    }
    .leaflet-bar a:hover { background-color: #f4f4f4; }
    .leaflet-bar a:first-child { border-top-left-radius: 4px; border-top-right-radius: 4px; }
    .leaflet-bar a:last-child { border-bottom-left-radius: 4px; border-bottom-right-radius: 4px; border-bottom: none; }
    .leaflet-control-attribution { font-size: 11px; padding: 0 6px; margin: 0 6px 6px 0; color: #333; background: rgba(255,255,255,0.85); border-radius: 6px; }
    /* POI name labels (Leaflet tooltip) — do not use “selected button” (blue/white) styling */
    .leaflet-tooltip {
      position: absolute;
      padding: var(--tn-label-pad);
      background: rgba(255,255,255,0.94);
      border: 1px solid rgba(0,0,0,0.12);
      border-radius: var(--tn-label-radius);
      white-space: nowrap;
      font-size: var(--tn-label-font);
      line-height: 1.25;
      color: #111;
      box-shadow: 0 6px 18px rgba(0,0,0,.12);
      text-shadow: none;
    }
    .leaflet-popup-content-wrapper,
    .leaflet-popup-tip {
      background: rgba(11,45,107,0.92) !important;
      color: #fff !important;
      border: 1px solid rgba(255,255,255,0.18);
    }
    .leaflet-popup-content-wrapper * { color: #fff !important; }
    .leaflet-container .leaflet-control-container { z-index: 1000; }
    #panel { position: fixed; right: var(--tn-edge); top: var(--tn-edge); bottom: var(--tn-edge); width: 380px; max-width: calc(100vw - (var(--tn-edge) * 2)); background: rgba(255,255,255,.98); border: 1px solid #eee; border-radius: 18px; display: flex; flex-direction: column; overflow: hidden; z-index: 1000; box-shadow: 0 14px 40px rgba(0,0,0,.12); contain: layout paint style; will-change: height, transform; backface-visibility: hidden; transform: translateZ(0); }
    #panelHeader { padding: 10px; border-bottom: 1px solid #eee; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; background: #fff; flex: 0 0 auto; }
    #panelBody { padding: 12px; overflow: auto; overflow-x: hidden; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; touch-action: pan-y pinch-zoom; will-change: scroll-position; transform: translateZ(0); }
    #panelCollapsedHint { display: none; padding: 0 12px 12px 12px; }
    #panel.collapsed { bottom: auto; height: auto; }
    #panel.collapsed #panelBody { display: none; }
    #panel.collapsed #panelCollapsedHint { display: block; }

    #lang { padding: 6px 8px; border-radius: 10px; border: 1px solid #ddd; background: #fff; }
    .muted { color: #666; font-size: 12px; line-height: 1.35; }
    .btn { padding: 10px 12px; border: 1px solid var(--tn-blue); background: #fff; color: var(--tn-blue); border-radius: 12px; cursor: pointer; }
    .btn:hover { background: var(--tn-blue-weak); }
    .btnPrimary { background: var(--tn-blue); color: #fff; border-color: var(--tn-blue); }
    

  

    .btn { min-height: 44px; font-size: 14px; touch-action: manipulation; }
    .btn:active { transform: translateY(1px); }
    .routeModeBtn { display:flex; flex-direction:column; align-items:flex-start; line-height:1.1; padding: 10px 12px; }
    .routeModeTitle { font-weight: 500; }
    .routeModeMeta { font-size: 12px; color: #666; margin-top: 4px; }
    .btnOn .routeModeMeta { color: rgba(255,255,255,.85); }

    .stepList { display:flex; flex-direction:column; gap: 8px; margin-top: 10px; }
    .stepItem { padding: 10px 12px; border: 1px solid #eee; border-radius: 14px; background: #fff; display:flex; justify-content: space-between; gap: 10px; }
    .stepText { font-weight: 400; }
    .stepSub { font-size: 12px; color: #666; margin-top: 4px; }
    .stepDist { font-size: 12px; color: #666; white-space: nowrap; padding-top: 2px; }
    .stepChips { display:flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
    .stepChip { display:inline-flex; align-items: center; gap: 6px; padding: 6px 10px; border-radius: 999px; border: 1px solid #e5e7eb; background: #fff; font-size: 12.5px; font-weight: 400; cursor: pointer; user-select: none; max-width: 100%; }
    .stepChip:hover { background: #fafafa; }
    .stepChipText { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .stepChipMeta { font-size: 12px; color: #666; white-space: nowrap; }
.btnOn { background: var(--tn-blue); color: #fff; border-color: var(--tn-blue); }
  .btnDanger { background: #b00020; color: #fff; border-color: #b00020; }
.row { display: flex; gap: 8px; align-items: center; }
    .imgGrid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
    .imgGrid img { width: 100%; height: 120px; object-fit: cover; border-radius: 10px; }
    .pill { padding: 4px 8px; border: 1px solid #ddd; border-radius: 999px; font-size: 12px; }
    .chips { display:flex; gap:8px; overflow-x:auto; padding: 2px 0; }
    .chip { flex: 0 0 auto; padding: 7px 10px; border-radius: 999px; border: 1px solid #e5e7eb; background: #fff; font-size: 12px; cursor: pointer; user-select: none; white-space: nowrap; }
    .chip:hover { background: #fafafa; }
    .chip.on { background: var(--tn-blue); color: #fff; border-color: var(--tn-blue); }
    #weatherRow { display:flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 12px; border: 1px solid #eee; border-radius: 14px; background:#fff; margin: 10px 0 12px 0; }
    #weatherText { font-size: 13px; font-weight: 500; }
    #weatherSub { font-size: 12px; color: #666; }
    .search { flex: 1 1 240px; min-width: 160px; padding: 10px 12px; border: 1px solid #ddd; border-radius: 12px; outline: none; }
    .search:focus { border-color: #bbb; }
    .select { padding: 10px 12px; border: 1px solid #ddd; border-radius: 12px; background: #fff; }
    .card { border: 1px solid #eee; border-radius: 14px; padding: 10px 12px; cursor: pointer; }
    .card:hover { background: #fafafa; }
    .list { display: flex; flex-direction: column; gap: 8px; }
    .poiPlainList { gap: 0; }
    .poiPlainItem {
      appearance: none;
      -webkit-appearance: none;
      width: 100%;
      text-align: left;
      border: none;
      border-radius: 0;
      background: transparent;
      box-shadow: none;
      padding: 14px 0;
      margin: 0;
      display: block;
      cursor: pointer;
      border-bottom: 1px solid rgba(15, 23, 42, 0.08);
    }
    .poiPlainItem:first-child { border-top: 1px solid rgba(15, 23, 42, 0.08); }
    .poiPlainItem:hover,
    .poiPlainItem:active,
    .poiPlainItem:focus { background: transparent; box-shadow: none; outline: none; }
    .poiPlainItem .row { gap: 12px; }
    .poiPlainItem .poiTitle { font-weight: 500; }
    .poiPlainItem .muted,
    .poiPlainDist { white-space: nowrap; }
    .h1 { font-size: 16px; font-weight: 600; }
    .h2 { font-size: 14px; font-weight: 500; }
    .spacer { height: 8px; }
    .kbd { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; padding: 2px 6px; border: 1px solid #ddd; border-radius: 8px; background: #fafafa; }
    .overlay { position: fixed; inset: 0; background: rgba(0,0,0,.55); display: none; align-items: center; justify-content: center; z-index: 9999; }
    .overlayInner { width: min(720px, 92vw); background: #fff; border-radius: 18px; overflow: hidden; box-shadow: 0 20px 60px rgba(0,0,0,.25); }
    .overlayHead { padding: 12px; border-bottom: 1px solid #eee; display: flex; align-items: center; justify-content: space-between; }
    .overlayBody { padding: 12px; }
    #qrVideo { width: 100%; border-radius: 14px; background: var(--tn-ink); }
    .danger { color: #b00020; }

    
    /* Header kiểu Google Maps (mobile-first) */
    #header { position: fixed; left: var(--tn-edge); right: var(--tn-edge); top: var(--tn-edge); z-index: 7; display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
    .brandRow { display:flex; gap: 10px; align-items: center; justify-content: space-between; pointer-events: auto; }
    .brandLeft { display:flex; align-items:center; gap: 8px; }
    .brandRight { display:flex; align-items:center; gap: 10px; }
    #brandLogo { height: 38px; width: auto; max-width: 200px; padding: 6px 10px; border-radius: 14px; border: 1px solid #e8e8e8; background:#fff; box-shadow: 0 6px 18px rgba(0,0,0,.10); object-fit: contain; }
    .searchRow { pointer-events: auto; }
    .searchBox { flex: 1 1 auto; display:flex; align-items:center; gap: 10px; background:#fff; border:1px solid #e8e8e8; border-radius: 18px; padding: 10px 12px; box-shadow: 0 6px 18px rgba(0,0,0,.10); }
    .searchBox .icon { font-size: 16px; opacity: .75; }
    .searchRow .searchBox { width: 100%; }
    #q { border: none; outline: none; width: 100%; min-width: 0; padding: 0; margin: 0; font-size: 14px; font-weight: 400; background: transparent; color: var(--tn-ink); }
    #lang { height: 40px; border-radius: 14px; border: 1px solid #e8e8e8; background:#fff; padding: 0 10px; font-weight: 500; box-shadow: 0 6px 18px rgba(0,0,0,.10); pointer-events: auto; }
    #btnTtsAuto { display:none !important; }
    #tabsBar { position: fixed; left: var(--tn-edge); right: var(--tn-edge); top: calc(var(--tn-map-top) + 10px); z-index: 6; pointer-events: none; }
    #tabsBar .tabsRow { display:flex; align-items:center; justify-content:space-between; gap: 10px; pointer-events: none; }
    #tabsBar .topTabs { display:flex; gap: 10px; pointer-events: auto; }
    .topTab { border: 1px solid #e8e8e8; background: #fff; color: #222; padding: 10px 12px; border-radius: 999px; font-weight: 500; font-size: 13px; box-shadow: 0 6px 18px rgba(0,0,0,.10); cursor:pointer; pointer-events:auto; touch-action: manipulation; }
    .topTab.active { border-color: var(--tn-blue); background: var(--tn-blue); color: #fff; }

    /* Weather pill (right side of tabs row) */
    #weatherRow.weatherPill { display:flex; align-items:center; gap: 8px; pointer-events: auto; border: 1px solid #e8e8e8; background:#fff; height: 40px; padding: 0 10px; border-radius: 999px; box-shadow: 0 6px 18px rgba(0,0,0,.10); max-width: 52%; }
    #weatherRow .weatherPillText { display:flex; flex-direction:column; justify-content:center; min-width: 0; }
    #weatherRow #weatherText { font-size: 12px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    #weatherRow #weatherSub { display:none; }
    #weatherRow .weatherPillBtn { height: 28px; width: 28px; padding: 0; min-width: 28px; border-radius: 999px; box-shadow: none; }


    /* Zoom controls: place above GPS button (mobile/tablet) */
    @media (max-width: 1024px) {
      .leaflet-control-zoom { position: fixed; right: 14px; bottom: calc(var(--tn-panel-h) + 12px + 62px); z-index: 6; }
      body:not(.tn-panel-collapsed) .leaflet-control-zoom { right: calc(14px + var(--tn-panel-w)); }
    }

    /* GPS floating button */
    #btnGps.gpsFab { position: fixed; right: 14px; bottom: calc(160px + env(safe-area-inset-bottom)); z-index: 6; width: 48px; height: 48px; border-radius: 999px; border: 1px solid #e8e8e8; background:#fff; box-shadow: 0 10px 24px rgba(0,0,0,.18); display:flex; align-items:center; justify-content:center; font-size: 22px; font-weight: 900; }
    #btnGps.gpsFab:active { transform: translateY(1px); }

    /* Không hiển thị nút Quét QR trên UI (vẫn giữ DOM để tránh lỗi JS) */
    #btnScan { display:none !important; }

    /* List text không đậm */
    .poiTitle { font-weight: 500; font-size: 15px; }
    .poiSub { font-weight: 400; }
      #tabsBar { right: calc(var(--tn-edge) + var(--tn-panel-w) + var(--tn-edge)); }
      #btnGps.gpsFab { right: calc(14px + var(--tn-panel-w) + var(--tn-edge)); }
    }

@media (max-width: 600px) {
      #header { left: var(--tn-edge); right: var(--tn-edge); top: calc(var(--tn-edge) + env(safe-area-inset-top)); }
      #tabsBar { left: var(--tn-edge); right: var(--tn-edge); }
      #btnGps.gpsFab { bottom: calc(170px + env(safe-area-inset-bottom)); }
    }

@media (max-width: 600px) {
      #panel { left: 0; right: 0; bottom: 0; top: auto; width: 100%; max-width: none; border-radius: 18px 18px 0 0; border-left: none; border-right: none; border-bottom: none; box-shadow: 0 -14px 40px rgba(0,0,0,.14); }
      #panel { height: var(--tn-panel-h); max-height: none; }
      #panel.collapsed { height: 96px; bottom: 0; }
      #panel.levelCollapsed { height: 96px; }
      #panelHeader { padding: 10px 12px; gap: 10px; }
      #panelBody { padding-bottom: calc(12px + env(safe-area-inset-bottom)); }
      #panel { padding-bottom: env(safe-area-inset-bottom); }

      /* drag handle */
      .sheetHandle {
        width: 44px;
        height: 5px;
        border-radius: 999px;
        background: #d9d9d9;
        margin: 0 auto;
        position: absolute;
        left: 50%;
        transform: translateX(-50%);
        top: 6px;
        pointer-events: none;
      }
      #panelHeader {
        position: relative;
        padding-top: 14px;
      }

      /* keep FAB buttons above the sheet (even if scan is later enabled) */
      #btnGps.gpsFab { bottom: calc(var(--tn-panel-h) + 12px); }
      #btnScan { bottom: calc(var(--tn-panel-h) + 70px); }

      .search { flex: 1 1 100%; min-width: 0; }
    }
  

    /* Active/selected states */
    .btn.btnOn, .btn.active { background: var(--tn-blue); color: #fff; border-color: var(--tn-blue); }
    .btn.btnOn:hover, .btn.active:hover { background: var(--tn-blue); }

    .chip.on { background: var(--tn-blue); color: #fff; border-color: var(--tn-blue); }
    .chip.on:hover { background: var(--tn-blue); }

    /* Disabled buttons keep readable */
    .btn:disabled { opacity: .55; cursor: not-allowed; }

    /* Hide QR scan button (use phone camera to scan QR at anchor) */
    #btnScan { display: none !important; }

    .btnOn .routeModeTitle, .btnOn .routeModeMeta { color: #fff; }

/* Edge spacing: mobile needs padding; larger screens can be edge-to-edge */
@media (max-width: 600px) { :root { --tn-edge: 10px; } }
@media (min-width: 601px) { :root { --tn-edge: 0px; } }
/* === Responsive overrides: tablet + desktop (fix "map not full", header layout, logo size) === */
:root { --tn-panel-w-collapsed: 72px; }

/* Tablet + small screens: use bottom-sheet panel so map uses full width */
@media (max-width: 1024px) {
  /* panel becomes bottom sheet */
  #panel { left: 0; right: 0; bottom: 0; top: auto; width: 100%; max-width: none; border-radius: 18px 18px 0 0; border-left: none; border-right: none; border-bottom: none; box-shadow: 0 -14px 40px rgba(0,0,0,.14); }
  #panel { height: var(--tn-panel-h); max-height: none; }
  #panel.collapsed { height: 96px; bottom: 0; }
  #panel.levelCollapsed { height: 96px; }
  #panelHeader { padding: 10px 12px; gap: 10px; }
  #panelBody { padding-bottom: calc(12px + env(safe-area-inset-bottom)); }
  #panel { padding-bottom: env(safe-area-inset-bottom); }

  /* header spans full width; override the desktop "reserve right panel" rule */
  #header { left: var(--tn-edge); right: var(--tn-edge); top: calc(var(--tn-edge) + env(safe-area-inset-top)); }
  #tabsBar { left: var(--tn-edge); right: var(--tn-edge); }

  /* keep FAB above the sheet */
  #btnGps.gpsFab { right: 14px; bottom: calc(var(--tn-panel-h) + 12px); }

  /* logo a bit larger on tablet */
  #brandLogo { height: 44px; width: auto; max-width: 220px; padding: 6px 12px; border-radius: 16px; }
}

/* Desktop: reserve space for right panel only when expanded */
@media (min-width: 1025px) {
  /* Make panel flush right so the map looks truly full-screen */
  #panel { right: 0; top: 0; bottom: 0; border-radius: 18px 0 0 18px; border-right: none; }

  body:not(.tn-panel-collapsed) #header { right: calc(var(--tn-panel-w) + var(--tn-edge)); }
  body:not(.tn-panel-collapsed) #tabsBar { right: calc(var(--tn-panel-w) + var(--tn-edge)); }
  body:not(.tn-panel-collapsed) #btnGps.gpsFab { right: calc(14px + var(--tn-panel-w)); }

  body.tn-panel-collapsed #header,
  body.tn-panel-collapsed #tabsBar { right: var(--tn-edge); }
  body.tn-panel-collapsed #btnGps.gpsFab { right: 14px; }

  /* Compact single-row header (logo | search | language) */
  #header { display: grid; grid-template-columns: auto 1fr auto; align-items: center; column-gap: 10px; row-gap: 0; }
  .brandRow, .searchRow { display: contents; }
  .brandLeft { grid-column: 1; }
  .searchRow .searchBox { grid-column: 2; }
  .brandRight { grid-column: 3; justify-content: flex-end; white-space: nowrap; }
  #brandLogo { height: 54px; width: auto; max-width: 260px; padding: 8px 14px; border-radius: 16px; }
  .searchBox { padding: 12px 14px; border-radius: 18px; }
  #q { font-size: 15px; }

  /* Collapse panel to a small button so map feels full-screen */
  #panel.collapsed { width: var(--tn-panel-w-collapsed); }
  #panel.collapsed #panelMiniStatus,
  #panel.collapsed #panelCollapsedHint { display: none; }
  #panel.collapsed #panelHeader { justify-content: center; }
  #panel.collapsed #btnPanel { width: 44px; padding: 10px 0; }
}


/* Alternative route labels */
.tnAltLabel span{display:inline-block; padding:4px 8px; border-radius:10px; background:rgba(0,0,0,0.6); color:#fff; font-size:12px; line-height:1; box-shadow:0 2px 8px rgba(0,0,0,0.25);}

/* Alternative route list (panel) */
.tnAltList{ display:flex; gap:8px; flex-wrap:wrap; }
.tnAltChoice{ padding:10px 12px; border-radius:14px; min-width:150px; white-space:normal; text-align:left; line-height:1.2; }
@media (max-width: 640px){
  .tnAltChoice{ min-width:140px; flex:1 1 calc(50% - 8px); }
}


/* Mobile panel handle + close */
#panelHandle{display:none; height:14px; align-items:center; justify-content:center; cursor:grab;}
#panelHandle:before{content:''; display:block; width:56px; height:5px; border-radius:6px; background:rgba(0,0,0,0.22);}
.btnClosePanel{display:none; padding:8px 10px; min-width:40px;}
@media (max-width: 640px){
  #panelHandle{display:flex;}
  .btnClosePanel{display:inline-flex; align-items:center; justify-content:center;}
}


/* Hybrid summary */
.tn-hybrid-summary{ margin-top:10px; }
.tn-hybrid-summary-text{ margin-top:6px; line-height:1.35; }

    /* My location marker (distinct from ⌖ button) */
.tn-myloc-wrap{ background: transparent !important; border: none !important; }
.tn-myloc-person{ width:26px; height:26px; position: relative; }
.tn-myloc-person svg{ display:block; width:26px; height:26px; border-radius:50%; box-shadow: 0 0 0 3px rgba(255,255,255,0.95), 0 8px 18px rgba(0,0,0,0.35); }
.tn-myloc-pulse{ position:absolute; left:50%; top:50%; width:26px; height:26px; border-radius:50%; border:2px solid rgba(239,68,68,0.30); transform: translate(-50%,-50%); animation: tnPulse 1.6s ease-out infinite; pointer-events:none; }
@keyframes tnPulse{ 0%{ transform: translate(-50%,-50%) scale(1); opacity:.70; } 100%{ transform: translate(-50%,-50%) scale(2.15); opacity:0; } }

/* Search suggestions (top 5) */
.searchBox{ position: relative; }
.searchSuggest{ position:absolute; left:0; right:0; top: calc(100% + 6px); background:#fff; border:1px solid rgba(0,0,0,0.12); border-radius:14px; box-shadow:0 10px 26px rgba(0,0,0,0.18); overflow:hidden; z-index: 20; }
.searchSuggestItem{ padding:10px 12px; cursor:pointer; display:flex; justify-content:space-between; gap:10px; align-items:baseline; }
.searchSuggestItem:hover{ background: var(--tn-blue-weak); }
.searchSuggestItem .name{ font-weight:800; }
.searchSuggestItem .meta{ font-size:12px; color:#6b7280; }

/* Nearby POIs along current route (Level 1: "sắp đi ngang") */
.nearbyStrip{ margin-top:10px; }
.nearbyTitle{ font-size:12px; font-weight:800; color:#334155; margin-bottom:6px; }
.nearbyList{ display:flex; gap:8px; overflow-x:auto; padding-bottom:4px; -webkit-overflow-scrolling: touch; }
.nearbyItem{ border:1px solid rgba(0,0,0,0.12); background:#fff; border-radius:999px; padding:8px 10px; font-size:13px; line-height:1; white-space:nowrap; }
.nearbyItem:hover{ background: var(--tn-blue-weak); }
.nearbyItem:active{ transform: translateY(1px); }

/* === Public UI: chỉ hiển thị như layout mẫu === */
#status{display:none !important;}
#panelCollapsedHint{display:none !important;}

@media (max-width: 1024px){
  /* Header sheet: back | title | close */
  #panelHeader{align-items:center; justify-content:space-between;}
  #btnPanel, #btnPanelClose{
    min-width:40px; width:40px; height:40px; padding:0;
    border-radius:14px;
    display:flex; align-items:center; justify-content:center;
    font-size:20px; font-weight:900;
  }
  #panelMiniStatus{
    font-size:18px !important;
    font-weight:800 !important;
    color: var(--tn-ink) !important;
    overflow:hidden; text-overflow:ellipsis; white-space:nowrap;
  }
  #panelMiniStatus.muted{color: var(--tn-ink) !important;}
}

/* --- Voice / Image search buttons --- */
/* --- Chatbot --- */
.chatFab{
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 9999;
  width: 52px;
  height: 52px;
  border-radius: 999px;
  border: 1px solid rgba(0,0,0,0.10);
  box-shadow: 0 10px 26px rgba(0,0,0,0.18);
  background: #ffffff;
  color: var(--tn-blue);
  font-size: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.chatFab:active{ transform: scale(0.98); }
.chatFab.hasUnread{ box-shadow: 0 10px 26px rgba(249,115,22,0.28); border-color: rgba(249,115,22,0.35); }
.chatFabBadge{ position:absolute; top:-4px; right:-2px; min-width:20px; height:20px; padding:0 6px; border-radius:999px; background:#f97316; color:#fff; font-size:11px; font-weight:700; line-height:20px; display:inline-flex; align-items:center; justify-content:center; box-shadow:0 6px 16px rgba(249,115,22,0.3); }

.chatMsgs{
  flex: 1 1 auto;
  min-height: 260px;
  max-height: none;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 8px 8px 16px;
  border: 1px solid #eee;
  border-radius: 14px;
  background: #fff;
  scroll-padding-bottom: 24px;
}

#chatOverlay .overlayInner{ display:flex; flex-direction:column; height:min(82vh, 780px); max-height:min(82vh, 780px); }
#chatOverlay .overlayBody{ display:grid; grid-template-rows:minmax(0,1fr) auto auto; gap:10px; min-height:0; flex:1 1 auto; }
#chatOverlay .overlayBody > .row{ margin-top:0 !important; position:static; background:#fff; z-index:1; padding-top:0; box-shadow:none; }

.chatMsg{
  max-width: 90%;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid rgba(0,0,0,0.08);
  background: #f8fafc;
  white-space: pre-wrap;
  line-height: 1.55;
  word-break: break-word;
}
.chatMsg.me{ align-self: flex-end; background: #eef2ff; border-color: #e0e7ff; text-align: left; }
.chatMsg.bot{ align-self: flex-start; text-align: justify; text-justify: inter-word; }
.chatMsg.staff{ align-self: flex-start; background:#ecfdf5; border-color:#a7f3d0; }
.chatMsg.system{ align-self: flex-start; background:#fff7ed; border-color:#fdba74; }
.chatMeta{ font-size: 12px; opacity: 0.7; margin-top: 6px; text-align: left; }

.chatMedia{ display:flex; flex-wrap:wrap; gap:8px; margin-top:8px; }
.chatMediaItem{ display:inline-flex; flex-direction:column; width:92px; text-decoration:none; border:0; background:transparent; padding:0; text-align:left; cursor:pointer; }
.chatMediaItem img{ width:92px; height:72px; object-fit:cover; border-radius:10px; border:1px solid rgba(0,0,0,.08); }
.chatMediaCap{ font-size:11px; margin-top:4px; opacity:.85; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }


.chatFabIcon{ width: 22px; height: 22px; fill: currentColor; color: var(--tn-blue); }


.field{
  height: 44px;
  padding: 0 12px;
  border-radius: 12px;
  border: 1px solid rgba(0,0,0,0.18);
  background: #fff;
  outline: none;
}
.field:focus{
  border-color: var(--tn-blue);
  box-shadow: 0 0 0 3px rgba(11,87,208,0.15);
}

#btnSendChat{ height:44px; border-radius:12px; padding:0 16px; }


/* Image viewer (chat) */
.tnImgViewer{ position:fixed; inset:0; background:rgba(0,0,0,.70); z-index:9999; display:flex; align-items:center; justify-content:center; padding:16px; }
.tnImgViewerBox{ width:min(96vw, 980px); height:min(92vh, 780px); background:#fff; border-radius:16px; overflow:hidden; display:flex; flex-direction:column; box-shadow:0 20px 60px rgba(0,0,0,.35); }
.tnImgViewerHead{ display:flex; align-items:center; justify-content:space-between; gap:10px; padding:10px 12px; border-bottom:1px solid rgba(0,0,0,.08); }
.tnImgViewerTitle{ font-weight:600; font-size:14px; color:#111; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.tnImgViewerBtns{ display:flex; gap:8px; }
.tnImgBtn{ border:1px solid rgba(0,0,0,.15); background:#fff; border-radius:10px; padding:6px 10px; cursor:pointer; font-size:14px; line-height:1; }
.tnImgViewerStage{ flex:1; background:#111; overflow:hidden; position:relative; touch-action:none; }
.tnImgViewerStage.dragging .tnImgViewerImg{ cursor:grabbing; }
.tnImgViewerCanvas{ position:absolute; inset:0; }
.tnImgViewerImg{ position:absolute; left:50%; top:50%; display:block; max-width:none; max-height:none; width:auto; height:auto; transform:translate(-50%, -50%) scale(1); transform-origin:center center; cursor:grab; user-select:none; -webkit-user-drag:none; }


/* Readable button states on public overlays/sheets */
.btn,
.btn:visited {
  color: var(--tn-blue);
}
.btn:hover,
.btn:focus-visible {
  color: var(--tn-blue);
}
.btn.btnPrimary,
.btn.btnPrimary:visited,
.btn.btnPrimary:hover,
.btn.btnPrimary:active,
.btn.btnPrimary:focus-visible,
.btn.btnOn,
.btn.active {
  background: var(--tn-blue) !important;
  border-color: var(--tn-blue) !important;
  color: #fff !important;
}
.btn:not(.btnPrimary):not(.btnOn):not(.active):active,
.btn:not(.btnPrimary):not(.btnOn):not(.active):focus-visible {
  background: var(--tn-blue-weak) !important;
  border-color: var(--tn-blue) !important;
  color: var(--tn-blue) !important;
}
.overlayInner,
.overlayHead,
.overlayBody {
  color: var(--tn-ink);
}
.overlayInner .btn:not(.btnPrimary):not(.btnOn):not(.active) {
  background: #fff;
  color: var(--tn-blue) !important;
}


/* ===== UI refresh v4.0.2: softer public palette, neutral controls, clearer overlays ===== */
:root{
  --tn-font: Inter, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", "Noto Sans KR", "Noto Sans SC", "Noto Sans TC", "PingFang SC", "Microsoft YaHei", "Malgun Gothic", sans-serif;
  --tn-base-font-size: 15px;
  --tn-blue: #2563eb;
  --tn-blue-weak: #eef4ff;
  --tn-ink: #1f2937;
  --tn-muted: #64748b;
  --tn-border: rgba(148,163,184,.28);
  --tn-border-strong: rgba(148,163,184,.45);
}
html, body{ font-family: var(--tn-font); color: var(--tn-ink); font-size: var(--tn-base-font-size); -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }
button, input, select, textarea, option{ font-family: inherit; }

.btn,
.btn:visited,
.topTab,
.chip,
#lang,
#btnGps.gpsFab,
.tnImgBtn{
  background: #fff;
  color: #334155;
  border-color: var(--tn-border);
  box-shadow: none;
  font-weight: 500;
}
.btn:hover,
.btn:focus-visible,
.topTab:hover,
.chip:hover,
#lang:hover,
.tnImgBtn:hover{
  background: #f8fafc;
  color: #0f172a;
  border-color: var(--tn-border-strong);
}
.btn.btnPrimary,
.btn.btnPrimary:visited,
.btn.btnPrimary:hover,
.btn.btnPrimary:active,
.btn.btnPrimary:focus-visible,
.btn.btnOn,
.btn.active,
.topTab.active,
.chip.on{
  background: var(--tn-blue) !important;
  border-color: var(--tn-blue) !important;
  color: #fff !important;
}
.btn:not(.btnPrimary):not(.btnOn):not(.active):active,
.btn:not(.btnPrimary):not(.btnOn):not(.active):focus-visible,
#q:focus,
.search:focus,
.select:focus,
.field:focus,
#lang:focus{
  outline: none;
  border-color: rgba(37,99,235,.55) !important;
  box-shadow: 0 0 0 3px rgba(37,99,235,.12);
}
.searchBox,
#panel,
#panelHeader,
.overlayInner,
.overlayHead,
.card,
#weatherRow.weatherPill,
#brandLogo{
  border-color: rgba(226,232,240,.95);
  box-shadow: 0 10px 28px rgba(15,23,42,.10);
}
.overlayInner,
.overlayHead,
.overlayBody,
.card,
.poiTitle,
.poiSub,
#weatherText,
#weatherSub,
.h1,
.h2{
  color: var(--tn-ink);
}
.overlay{ background: rgba(15,23,42,.42); }
.overlayInner{ background: rgba(255,255,255,.985); }
.leaflet-popup-content-wrapper,
.leaflet-popup-tip{
  background: rgba(255,255,255,.98) !important;
  color: #0f172a !important;
  border: 1px solid rgba(148,163,184,.38) !important;
  box-shadow: 0 12px 28px rgba(15,23,42,.14);
}
.leaflet-popup-content-wrapper *{ color: #0f172a !important; }
.leaflet-tooltip{
  color: #111827;
  background: rgba(255,255,255,.96);
  border-color: rgba(148,163,184,.34);
}
.poiTitle,
.searchSuggestItem .name,
.nearbyTitle,
#weatherText,
.tnImgViewerTitle{ font-weight: 600; }
#q,
.poiSub,
.stepText,
.stepChip,
.topTab,
.chip{ font-weight: 400; }




/* === 2026-04-06: smoother public bottom-sheet drag === */
@media (max-width: 1024px) {
  #panelHandle,
  #panelHeader,
  #panelCollapsedHint {
    touch-action: none;
    user-select: none;
    will-change: transform;
    transform: translateZ(0);
  }

  #panel {
    will-change: height, transform;
  }

  #panel.tn-dragging {
    transition: none !important;
    box-shadow: 0 -10px 24px rgba(0,0,0,.10);
  }

  body.tn-panel-dragging #panelBody {
    pointer-events: none;
  }
}

.poiPlainList{ gap: 0 !important; }
.poiPlainItem,
.poiPlainItem.card{
  border-left: 0 !important;
  border-right: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
}
.poiPlainItem .poiTitle{ display:block; }



.chatField{
  width: 100%;
}

.floorLevelList,
.floorStartNodeList{
  display:grid;
  grid-template-columns:repeat(auto-fit, minmax(120px, 1fr));
  gap:10px;
}
.floorChoiceBtn,
.floorStartBtn{
  border:1px solid #cfdff7;
  background:#fff;
  border-radius:14px;
  padding:12px 12px;
  text-align:left;
  color:#16325c;
  box-shadow:0 6px 18px rgba(21,73,153,.08);
}
.floorChoiceBtn .floorChoiceTitle,
.floorStartBtn .floorStartTitle{
  font-weight:700;
  font-size:14px;
}
.floorChoiceBtn .floorChoiceSub,
.floorStartBtn .floorStartSub{
  margin-top:4px;
  font-size:12px;
  color:#6b7a90;
}
.floorChoiceBtn.active,
.floorStartBtn.active{
  border-color:#4d8cff;
  background:#eef5ff;
  box-shadow:0 8px 20px rgba(77,140,255,.16);
}
#floorOverlay .overlayInner{
  width:min(560px, 94vw);
}
#floorOverlayStatus.warn{
  color:#9d5c00;
}


/* Navigation compact mode: hide top search/header on mobile, keep only exit + locate */
.navExitFab {
  display: none;
  position: fixed;
  left: 14px;
  top: calc(var(--tn-edge) + env(safe-area-inset-top));
  z-index: 8;
  width: 48px;
  height: 48px;
  border-radius: 999px;
  border: 1px solid #e8e8e8;
  background: #fff;
  box-shadow: 0 10px 24px rgba(0,0,0,.18);
  align-items: center;
  justify-content: center;
  font-size: 22px;
  font-weight: 900;
  color: var(--tn-ink);
}
.navExitFab:active { transform: translateY(1px); }

@media (max-width: 1024px) {
  body.tn-route-active #header,
  body.tn-route-active #tabsBar {
    display: none !important;
  }

  body.tn-route-active #btnChatFab,
  body.tn-route-active #btnScan {
    display: none !important;
  }

  body.tn-route-active .navExitFab {
    display: inline-flex;
  }

  body.tn-route-active #btnGps.gpsFab {
    top: calc(var(--tn-edge) + env(safe-area-inset-top));
    bottom: auto;
    right: 14px;
  }

  body.tn-route-active .leaflet-control-zoom {
    top: calc(var(--tn-edge) + env(safe-area-inset-top) + 60px);
    bottom: auto;
    right: 14px;
  }
}

.routeModeCompactBar {
  display: none;
  align-items: center;
  gap: 8px;
  padding: 8px 12px 0 12px;
  background: transparent;
  flex-wrap: wrap;
  justify-content: center;
}
.routeModeCompactBtn {
  min-width: 92px;
  height: 40px;
  padding: 0 14px;
  border: none;
  border-radius: 999px;
  background: transparent;
  color: #45556f;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}
.routeModeCompactBtn:hover {
  background: rgba(11,87,208,.08);
}
.routeModeCompactBtn.is-active {
  background: var(--tn-blue);
  color: #fff;
  box-shadow: 0 8px 18px rgba(11,87,208,.25);
}
.routeModeCompactBtn:disabled {
  opacity: .45;
  cursor: default;
}
@media (max-width: 1024px) {
  body.tn-route-active #panel .routeModeCompactBar.has-items {
    display: inline-flex;
  }
  body.tn-route-active #panel.collapsed .routeModeCompactBar.has-items {
    display: inline-flex;
  }
}
@media (max-width: 600px) {
  .routeModeCompactBar {
    padding: 8px 10px 0 10px;
    gap: 6px;
  }
  .routeModeCompactBtn {
    min-width: 84px;
    font-size: 13px;
    padding: 0 12px;
  }
}


@media (max-width: 1024px) {
  body.tn-route-active #panel .routeModeCompactBar.has-items + #panelHeader {
    padding-top: 8px;
  }
}

@media (max-width: 1024px) {
  body.tn-route-active #panel.collapsed,
  body.tn-route-active #panel.levelCollapsed {
    height: 128px;
  }

  body.tn-route-active #panel.collapsed #panelHeader,
  body.tn-route-active #panel.levelCollapsed #panelHeader {
    display: flex !important;
    padding-top: 4px;
  }

  body.tn-route-active #panel.collapsed #panelCollapsedHint,
  body.tn-route-active #panel.levelCollapsed #panelCollapsedHint {
    display: none !important;
  }

  body.tn-route-active #panel.collapsed .routeModeCompactBar.has-items,
  body.tn-route-active #panel.levelCollapsed .routeModeCompactBar.has-items {
    padding: 8px 10px 0 10px;
  }

  body.tn-route-active #panel.collapsed #panelMiniStatus,
  body.tn-route-active #panel.levelCollapsed #panelMiniStatus {
    cursor: pointer;
  }
}



/* === 2026-04-25: POI marker UX refresh ===
   Controls remain circular; POI markers stay compact and readable.
   Uploaded image icons render full; fallback/vector icons use a subtle colored circle. */
.tn-poi-div-icon {
  background: transparent !important;
  border: 0 !important;
}
.tn-poi-div-icon .tn-poi-marker {
  --tn-poi-size: 40px;
  --tn-poi-color: #2563eb;
  position: relative;
  width: calc(var(--tn-poi-size) + 8px);
  height: calc(var(--tn-poi-size) + 8px);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  pointer-events: auto;
  touch-action: manipulation;
  transform-origin: center center;
  transition: transform .16s ease, filter .16s ease, opacity .16s ease;
}
.tn-poi-div-icon .tn-poi-marker__badge {
  position: relative;
  z-index: 2;
  width: var(--tn-poi-size);
  height: var(--tn-poi-size);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border-radius: 999px;
  background: color-mix(in srgb, var(--tn-poi-color) 92%, #ffffff 8%);
  border: 2px solid rgba(255,255,255,.95);
  box-shadow: 0 6px 12px rgba(15,23,42,.18), 0 1px 0 rgba(255,255,255,.18) inset;
}
.tn-poi-div-icon .tn-poi-marker__badge::before {
  content: "";
  position: absolute;
  inset: -4px;
  border-radius: 999px;
  background: transparent;
  transition: box-shadow .16s ease, transform .16s ease;
}
.tn-poi-div-icon .tn-poi-marker__tip {
  display: none;
}
.tn-poi-div-icon .tn-poi-marker__icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 70%;
  height: 70%;
}
.tn-poi-div-icon .tn-poi-marker__icon svg {
  display: block;
  width: 100%;
  height: 100%;
}
.tn-poi-div-icon .tn-poi-marker__image {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center center;
}
.tn-poi-div-icon .tn-poi-marker.has-image .tn-poi-marker__badge {
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: 0 5px 12px rgba(15,23,42,.16);
}
.tn-poi-div-icon .tn-poi-marker.is-selected {
  transform: scale(1.05);
}
.tn-poi-div-icon .tn-poi-marker.is-selected .tn-poi-marker__badge::before,
.tn-poi-div-icon .tn-poi-marker.is-dest .tn-poi-marker__badge::before {
  box-shadow: 0 0 0 3px #2563eb, 0 0 0 8px rgba(37,99,235,.14);
}
.tn-poi-div-icon .tn-poi-marker.is-start .tn-poi-marker__badge::before {
  box-shadow: 0 0 0 3px #10b981, 0 0 0 8px rgba(16,185,129,.14);
}
.tn-poi-div-icon .tn-poi-marker.is-preview:not(.is-selected):not(.is-dest) {
  opacity: .96;
  transform: scale(.98);
}
.tn-poi-div-icon .tn-poi-marker:active {
  transform: translateY(1px) scale(.98);
}
.tn-poi-div-icon .tn-poi-marker.is-selected:active,
.tn-poi-div-icon .tn-poi-marker.is-dest:active {
  transform: translateY(1px) scale(1.03);
}
@media (max-width: 600px) {
  .tn-poi-div-icon .tn-poi-marker {
    --tn-poi-size: 38px;
    width: calc(var(--tn-poi-size) + 8px);
    height: calc(var(--tn-poi-size) + 8px);
  }
  .tn-poi-div-icon .tn-poi-marker__icon {
    width: 72%;
    height: 72%;
  }
}



