
/* =========================================================
   HÀO DRINK — ĐỒNG BỘ HEADER MOBILE CHO CÁC TRANG KHÁCH HÀNG
   Dán ở CUỐI css/style.css
   ========================================================= */
@media (max-width: 650px) {
    .header {
        position: relative;
        z-index: 100;
        width: 100%;
        background: #fff;
        box-shadow: 0 4px 18px rgba(25, 65, 42, 0.07);
    }

    .header .header-container {
        width: calc(100% - 28px) !important;
        max-width: 100% !important;
        min-width: 0 !important;
        min-height: 0 !important;
        margin: 0 auto !important;
        padding: 12px 0 8px !important;
        display: grid !important;
        grid-template-columns: minmax(0, 1fr) auto auto !important;
        grid-template-areas:
            "logo user cart"
            "search search search"
            "nav nav nav" !important;
        align-items: center !important;
        column-gap: 8px !important;
        row-gap: 9px !important;
        overflow: visible !important;
    }

    .header .header-container > .logo {
        grid-area: logo !important;
        display: inline-flex !important;
        align-items: center !important;
        justify-self: start !important;
        min-width: 0 !important;
        max-width: 100% !important;
        margin: 0 !important;
        gap: 3px !important;
        white-space: nowrap !important;
        font-size: clamp(17px, 4.6vw, 21px) !important;
        line-height: 1 !important;
    }

    .header .header-container > .logo svg {
        width: 26px !important;
        height: 26px !important;
        flex: 0 0 26px !important;
    }

    .header .header-container > #user-header {
        grid-area: user !important;
        justify-self: end !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        width: 32px !important;
        min-width: 32px !important;
        max-width: 32px !important;
        margin: 0 !important;
        padding: 0 !important;
    }

    .header .user-header-guest,
    .header .user-header-admin {
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        gap: 4px !important;
        min-width: 0 !important;
        margin: 0 !important;
    }

    .header .user-header-link {
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
        width: 32px !important;
        min-width: 32px !important;
        height: 32px !important;
        min-height: 32px !important;
        padding: 0 !important;
        border: 1px solid #dce9df !important;
        border-radius: 50% !important;
        background: #fff !important;
        color: #39865a !important;
        font-size: 16px !important;
        line-height: 1 !important;
        overflow: visible !important;
    }

    .header .user-header-link .user-header-text {
        display: none !important;
    }

    .header .user-header-link .user-header-icon {
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
        width: 18px !important;
        height: 18px !important;
        font-size: 16px !important;
        line-height: 1 !important;
    }

    .header .user-header-admin-link,
    .header .user-header-logout,
    .header .user-header-admin-label {
        font-size: 10px !important;
        line-height: 1.2 !important;
        padding: 4px 6px !important;
        white-space: nowrap !important;
    }

    .header .header-container > .cart {
        grid-area: cart !important;
        justify-self: end !important;
        position: relative !important;
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
        width: 38px !important;
        min-width: 38px !important;
        height: 38px !important;
        min-height: 38px !important;
        margin: 0 !important;
        padding: 0 !important;
        border-radius: 50% !important;
        border: 1px solid #dce9df !important;
        background: #fff !important;
        color: #39865a !important;
        font-size: 16px !important;
        line-height: 1 !important;
        white-space: nowrap !important;
    }

    .header .header-container > .cart span {
        display: none !important;
    }

    .header .header-container > .cart b {
        position: absolute !important;
        top: -5px !important;
        right: -4px !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        min-width: 17px !important;
        width: 17px !important;
        height: 17px !important;
        padding: 0 !important;
        border-radius: 50% !important;
        font-size: 10px !important;
        line-height: 1 !important;
    }

    .header .header-container > .header-search {
        grid-area: search !important;
        display: flex !important;
        width: 100% !important;
        max-width: none !important;
        min-width: 0 !important;
        margin: 0 !important;
    }

    .header .header-search input {
        width: 100% !important;
        min-width: 0 !important;
        height: 40px !important;
        font-size: 13px !important;
    }

    .header .header-container > .navbar,
    .header .header-container > .nav {
        grid-area: nav !important;
        display: flex !important;
        flex-wrap: nowrap !important;
        align-items: center !important;
        justify-content: flex-start !important;
        gap: 18px !important;
        width: 100% !important;
        min-width: 0 !important;
        margin: 0 !important;
        padding: 0 0 3px !important;
        overflow-x: auto !important;
        overflow-y: hidden !important;
        white-space: nowrap !important;
        scrollbar-width: none !important;
        -webkit-overflow-scrolling: touch;
    }

    .header .header-container > .navbar::-webkit-scrollbar,
    .header .header-container > .nav::-webkit-scrollbar {
        display: none !important;
    }

    .header .header-container > .navbar a,
    .header .header-container > .nav a {
        flex: 0 0 auto !important;
        display: inline-flex !important;
        align-items: center !important;
        min-height: 32px !important;
        padding: 7px 0 !important;
        margin: 0 !important;
        font-size: 12px !important;
        line-height: 1.25 !important;
        white-space: nowrap !important;
    }

    .header .header-container > .navbar a::after,
    .header .header-container > .nav a::after {
        bottom: 0 !important;
    }

    /* Trang không có thanh tìm kiếm: menu chuyển ngay xuống hàng 2,
       tránh tạo một hàng trống. */
    .header .header-container:not(:has(.header-search)) {
        grid-template-areas:
            "logo user cart"
            "nav nav nav" !important;
    }

    .header .header-container:not(:has(.header-search)) > .navbar,
    .header .header-container:not(:has(.header-search)) > .nav {
        grid-row: 2 !important;
    }
}

@media (max-width: 380px) {
    .header .header-container {
        width: calc(100% - 22px) !important;
        column-gap: 5px !important;
    }

    .header .header-container > .logo {
        font-size: 16px !important;
    }

    .header .header-container > .logo svg {
        width: 23px !important;
        height: 23px !important;
        flex-basis: 23px !important;
    }

    .header .header-container > .navbar,
    .header .header-container > .nav {
        gap: 14px !important;
    }

    .header .header-container > .navbar a,
    .header .header-container > .nav a {
        font-size: 11px !important;
    }
}


/* ADMIN HEADER MOBILE — tách cụm quản trị để không tràn lên logo/giỏ hàng */
@media (max-width: 650px) {
    .header .header-container:has(#user-header .user-header-admin) {
        grid-template-columns: minmax(0, 1fr) 38px !important;
        grid-template-areas:
            "logo cart"
            "user user"
            "search search"
            "nav nav" !important;
    }

    .header .header-container:has(#user-header .user-header-admin) > #user-header {
        grid-area: user !important;
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
        justify-self: stretch !important;
        justify-content: flex-start !important;
        overflow-x: auto !important;
        overflow-y: hidden !important;
        padding: 2px 0 !important;
    }

    .header .header-container:has(#user-header .user-header-admin) .user-header-admin {
        width: max-content !important;
        max-width: 100% !important;
        justify-content: flex-start !important;
        flex-wrap: nowrap !important;
        gap: 6px !important;
    }

    .header .header-container:has(#user-header .user-header-admin) .user-header-admin-link,
    .header .header-container:has(#user-header .user-header-admin) .user-header-logout,
    .header .header-container:has(#user-header .user-header-admin) .user-header-admin-label {
        flex: 0 0 auto !important;
        font-size: 10px !important;
        white-space: nowrap !important;
    }
}


/* LOGO HÀO DRINK DÙNG CHUNG — SVG rõ nét ở mọi kích thước */
.header .logo .logo-mark,
.header .logo .logo-leaf {
    display: block;
    width: 38px;
    height: 38px;
    flex: 0 0 38px;
    object-fit: contain;
}

@media (max-width: 650px) {
    .header .logo .logo-mark,
    .header .logo .logo-leaf {
        width: 30px;
        height: 30px;
        flex-basis: 30px;
    }
}

/* HEADER MOBILE PATCH — HÀO DRINK */
@media (max-width: 650px) {
  .header { width:100%; }
  .header .header-container {
    display:grid !important;
    grid-template-columns:minmax(0,1fr) auto auto !important;
    grid-template-areas:"logo user cart" "search search search" "nav nav nav" !important;
    align-items:center !important; gap:9px 8px !important;
    width:calc(100% - 28px) !important; padding:12px 0 9px !important;
  }
  .header .header-container > .logo { grid-area:logo !important; min-width:0 !important; }
  .header .header-container > #user-header { grid-area:user !important; }
  .header .header-container > .cart { grid-area:cart !important; }
  .header .header-container > .header-search { grid-area:search !important; width:100% !important; }
  .header .header-container > .navbar { grid-area:nav !important; width:100% !important; display:flex !important; flex-wrap:nowrap !important; overflow-x:auto !important; gap:16px !important; scrollbar-width:none !important; }
  .header .header-container > .navbar::-webkit-scrollbar { display:none !important; }
  .header .header-container > .navbar a { flex:0 0 auto !important; white-space:nowrap !important; }
  .header .header-container > #user-header { width:auto !important; max-width:42px !important; }
  .header .user-header-admin { max-width:42px !important; overflow:hidden !important; }
  .header .user-header-admin-link, .header .user-header-logout, .header .user-header-admin-label {
    font-size:10px !important; padding:4px 6px !important; white-space:nowrap !important;
  }
}
@media (max-width:380px) {
  .header .header-container { width:calc(100% - 22px) !important; column-gap:5px !important; }
  .header .header-container > .logo { font-size:16px !important; }
  .header .header-container > .navbar { gap:13px !important; }
  .header .header-container > .navbar a { font-size:11px !important; }
}


/* Mobile hamburger menu: thu gọn các mục và chỉ mở khi nhấn dấu ≡ */
@media (max-width: 650px) {
  .header .header-container > .mobile-menu-toggle {
    grid-area: toggle !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 38px !important;
    min-width: 38px !important;
    height: 38px !important;
    padding: 0 !important;
    border: 1px solid #dce9df !important;
    border-radius: 50% !important;
    background: #f4faf5 !important;
    color: #347c50 !important;
    font-size: 27px !important;
    line-height: 1 !important;
    cursor: pointer !important;
    box-shadow: 0 2px 7px rgba(32, 90, 52, .08) !important;
  }
  .header .header-container {
    grid-template-columns: minmax(0,1fr) auto auto !important;
    grid-template-areas: "logo cart toggle" "search search search" "nav nav nav" "user user user" !important;
  }
  .header .header-container > #user-header,
  .header .header-container > .navbar,
  .header .header-container > .nav { display: none !important; }
  .header .header-container.mobile-menu-open > #user-header {
    grid-area: user !important;
    display: flex !important;
    width: 100% !important;
    max-width: none !important;
    min-width: 0 !important;
    justify-content: flex-start !important;
    flex-wrap: wrap !important;
    padding: 10px 0 2px !important;
    border-top: 1px solid #e7efe8 !important;
  }
  .header .header-container.mobile-menu-open > .navbar,
  .header .header-container.mobile-menu-open > .nav {
    grid-area: nav !important;
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 8px !important;
    padding: 7px 0 !important;
    overflow: visible !important;
    white-space: normal !important;
    border-top: 1px solid #e7efe8 !important;
  }
  .header .header-container.mobile-menu-open > .navbar a,
  .header .header-container.mobile-menu-open > .nav a {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    min-height: 34px !important;
    padding: 8px 11px !important;
    border: 1px solid #e0ebe2 !important;
    border-radius: 9px !important;
    background: #fff !important;
    color: #315c3e !important;
    font-size: 12px !important;
    text-decoration: none !important;
  }
  .header .header-container.mobile-menu-open > .navbar a.active,
  .header .header-container.mobile-menu-open > .nav a.active {
    background: #eaf4ec !important;
    border-color: #b9d8c0 !important;
  }
}
@media (min-width: 651px) { .mobile-menu-toggle { display: none !important; } }

/* HÀO DRINK — mobile header compact layout v2 */
@media (max-width: 650px) {
  body .header {
    height: auto !important;
    min-height: 0 !important;
    padding: 0 !important;
    margin: 0 !important;
    overflow: visible !important;
  }
  body .header .header-container {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) 42px 42px !important;
    grid-template-areas: "logo cart toggle" "search search search" !important;
    align-items: center !important;
    justify-content: stretch !important;
    gap: 10px 8px !important;
    width: calc(100% - 28px) !important;
    max-width: none !important;
    height: auto !important;
    min-height: 0 !important;
    margin: 0 auto !important;
    padding: 10px 0 11px !important;
    box-sizing: border-box !important;
  }
  body .header .header-container > .logo {
    grid-area: logo !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-self: start !important;
    width: max-content !important;
    max-width: 100% !important;
    min-width: 0 !important;
    margin: 0 !important;
    white-space: nowrap !important;
  }
  body .header .header-container > .cart {
    grid-area: cart !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 42px !important;
    min-width: 42px !important;
    height: 42px !important;
    padding: 0 !important;
    margin: 0 !important;
    border-radius: 50% !important;
    position: relative !important;
    font-size: 0 !important;
  }
  body .header .header-container > .cart span { display: none !important; }
  body .header .header-container > .cart b {
    position: absolute !important;
    top: -4px !important;
    right: -4px !important;
    min-width: 18px !important;
    height: 18px !important;
    padding: 0 4px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    border-radius: 99px !important;
    font-size: 10px !important;
  }
  body .header .header-container > .mobile-menu-toggle {
    grid-area: toggle !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    justify-self: end !important;
    width: 42px !important;
    min-width: 42px !important;
    height: 42px !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 1px solid #dce9df !important;
    border-radius: 12px !important;
    background: #f3f8f4 !important;
    color: #347c50 !important;
    font-size: 27px !important;
    line-height: 1 !important;
    box-shadow: none !important;
  }
  body .header .header-container > .header-search {
    grid-area: search !important;
    display: flex !important;
    width: 100% !important;
    min-width: 0 !important;
    height: 42px !important;
    margin: 0 !important;
    padding: 0 5px 0 14px !important;
    border-radius: 24px !important;
    box-sizing: border-box !important;
  }
  body .header .header-container > .header-search input {
    min-width: 0 !important;
    width: 100% !important;
    height: 40px !important;
    font-size: 13px !important;
  }
  body .header .header-container > #user-header,
  body .header .header-container > .navbar,
  body .header .header-container > .nav {
    display: none !important;
  }
  body .header .header-container.mobile-menu-open {
    grid-template-areas: "logo cart toggle" "search search search" "nav nav nav" "user user user" !important;
  }
  body .header .header-container.mobile-menu-open > .navbar,
  body .header .header-container.mobile-menu-open > .nav {
    grid-area: nav !important;
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: wrap !important;
    align-items: center !important;
    gap: 7px !important;
    width: 100% !important;
    padding: 10px 0 2px !important;
    margin: 0 !important;
    border-top: 1px solid #e8efe9 !important;
    overflow: visible !important;
  }
  body .header .header-container.mobile-menu-open > .navbar a,
  body .header .header-container.mobile-menu-open > .nav a {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    min-height: 34px !important;
    padding: 7px 11px !important;
    border: 1px solid #e0eae2 !important;
    border-radius: 9px !important;
    background: #fff !important;
    color: #315c3e !important;
    font-size: 12px !important;
    line-height: 1.2 !important;
    white-space: nowrap !important;
  }
  body .header .header-container.mobile-menu-open > #user-header {
    grid-area: user !important;
    display: flex !important;
    align-items: center !important;
    flex-wrap: wrap !important;
    gap: 7px !important;
    width: 100% !important;
    max-width: none !important;
    min-width: 0 !important;
    padding: 10px 0 2px !important;
    margin: 0 !important;
    border-top: 1px solid #e8efe9 !important;
  }
  body .header .header-container.mobile-menu-open > #user-header * {
    max-width: 100% !important;
    box-sizing: border-box !important;
  }
}


/* FINAL MOBILE HEADER LAYOUT FIX — HÀO DRINK */
@media (max-width: 700px) {
  body .header { display:block !important; width:100% !important; height:auto !important; min-height:0 !important; padding:8px 0 10px !important; margin:0 !important; position:relative !important; }
  body .header .header-container {
    width:100% !important; max-width:100% !important; min-height:0 !important; height:auto !important;
    margin:0 !important; padding:8px 14px 10px !important; box-sizing:border-box !important;
    display:grid !important; grid-template-columns:minmax(0,1fr) 42px 42px !important;
    grid-template-areas:"logo cart toggle" "search search search" !important;
    align-items:center !important; justify-items:stretch !important; gap:10px 8px !important;
    overflow:visible !important; transform:none !important;
  }
  body .header .header-container > .logo { grid-area:logo !important; justify-self:start !important; align-self:center !important; display:flex !important; align-items:center !important; width:max-content !important; max-width:100% !important; min-width:0 !important; height:42px !important; margin:0 !important; padding:0 !important; white-space:nowrap !important; }
  body .header .header-container > .logo img { max-height:30px !important; width:auto !important; max-width:34px !important; object-fit:contain !important; }
  body .header .header-container > .logo span { font-size:17px !important; line-height:1 !important; }
  body .header .header-container > .cart { grid-area:cart !important; display:inline-flex !important; align-items:center !important; justify-content:center !important; justify-self:end !important; position:relative !important; width:40px !important; min-width:40px !important; height:40px !important; margin:0 !important; padding:0 !important; border-radius:50% !important; font-size:18px !important; line-height:1 !important; }
  body .header .header-container > .cart span { display:none !important; }
  body .header .header-container > .cart b { position:absolute !important; top:-3px !important; right:-3px !important; min-width:17px !important; height:17px !important; padding:0 4px !important; display:flex !important; align-items:center !important; justify-content:center !important; border-radius:99px !important; font-size:10px !important; }
  body .header .header-container > .mobile-menu-toggle { grid-area:toggle !important; display:inline-flex !important; align-items:center !important; justify-content:center !important; justify-self:end !important; width:40px !important; min-width:40px !important; height:40px !important; margin:0 !important; padding:0 !important; border:1px solid #dce9df !important; border-radius:12px !important; background:#f3f8f4 !important; color:#347c50 !important; font-size:27px !important; line-height:1 !important; box-shadow:none !important; }
  body .header .header-container > .header-search { grid-area:search !important; display:flex !important; width:100% !important; min-width:0 !important; height:42px !important; margin:0 !important; padding:0 5px 0 13px !important; border:1px solid #e0e9e1 !important; border-radius:24px !important; background:#f7faf7 !important; box-sizing:border-box !important; }
  body .header .header-container > .header-search input { min-width:0 !important; width:100% !important; height:40px !important; margin:0 !important; padding:0 8px !important; font-size:13px !important; }
  body .header .header-container > .header-search button { flex:0 0 32px !important; width:32px !important; min-width:32px !important; height:32px !important; margin:0 !important; padding:6px !important; }
  body .header .header-container > .navbar, body .header .header-container > .nav { display:none !important; }
  body .header .header-container > #user-header { display:none !important; }
  body .header .header-container.mobile-menu-open { grid-template-areas:"logo cart toggle" "search search search" "nav nav nav" "user user user" !important; }
  body .header .header-container.mobile-menu-open > .navbar, body .header .header-container.mobile-menu-open > .nav { grid-area:nav !important; display:flex !important; flex-direction:row !important; flex-wrap:wrap !important; align-items:center !important; gap:7px !important; width:100% !important; min-width:0 !important; padding:10px 0 2px !important; margin:0 !important; border-top:1px solid #e8efe9 !important; overflow:visible !important; }
  body .header .header-container.mobile-menu-open > .navbar a, body .header .header-container.mobile-menu-open > .nav a { display:inline-flex !important; align-items:center !important; justify-content:center !important; min-height:34px !important; padding:7px 11px !important; border:1px solid #e0eae2 !important; border-radius:9px !important; background:#fff !important; color:#315c3e !important; font-size:12px !important; line-height:1.2 !important; white-space:nowrap !important; }
  body .header .header-container.mobile-menu-open > #user-header { grid-area:user !important; display:flex !important; align-items:center !important; flex-wrap:wrap !important; gap:7px !important; width:100% !important; max-width:none !important; min-width:0 !important; padding:10px 0 2px !important; margin:0 !important; border-top:1px solid #e8efe9 !important; }
  body .header .header-container.mobile-menu-open > #user-header * { max-width:100% !important; box-sizing:border-box !important; }
}


/* FINAL OVERRIDE: compact, predictable mobile header layout */
@media (max-width: 700px) {
  html body header.header {
    display: block !important;
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: visible !important;
  }
  html body header.header > .header-container {
    display: grid !important;
    position: relative !important;
    grid-template-columns: minmax(0, 1fr) 40px 40px !important;
    grid-template-rows: 44px 42px auto auto !important;
    grid-template-areas: "logo cart toggle" "search search search" "nav nav nav" "user user user" !important;
    align-content: start !important;
    align-items: center !important;
    justify-items: stretch !important;
    gap: 9px 8px !important;
    width: 100% !important;
    min-height: 0 !important;
    height: auto !important;
    max-height: none !important;
    margin: 0 !important;
    padding: 10px 14px 12px !important;
    box-sizing: border-box !important;
    overflow: visible !important;
    transform: none !important;
  }
  html body header.header > .header-container > .logo {
    grid-area: logo !important; display: flex !important; justify-self: start !important;
    align-self: center !important; width: max-content !important; max-width: 100% !important;
    min-width: 0 !important; height: 40px !important; margin: 0 !important; padding: 0 !important;
  }
  html body header.header > .header-container > .logo .logo-leaf { width: 24px !important; max-width: 24px !important; height: 30px !important; object-fit: contain !important; }
  html body header.header > .header-container > .logo span { font-size: 16px !important; line-height: 1 !important; }
  html body header.header > .header-container > .cart {
    grid-area: cart !important; position: relative !important; justify-self: center !important;
    display: inline-flex !important; width: 38px !important; min-width: 38px !important;
    height: 38px !important; margin: 0 !important; padding: 0 !important;
    align-items: center !important; justify-content: center !important; border-radius: 50% !important;
  }
  html body header.header > .header-container > .cart span { display: none !important; }
  html body header.header > .header-container > .cart b { top: -4px !important; right: -4px !important; }
  html body header.header > .header-container > .mobile-menu-toggle {
    grid-area: toggle !important; position: static !important; display: inline-flex !important;
    justify-self: end !important; align-self: center !important; width: 38px !important;
    min-width: 38px !important; height: 38px !important; margin: 0 !important; padding: 0 !important;
    align-items: center !important; justify-content: center !important; border-radius: 11px !important;
    border: 1px solid #dce9df !important; background: #f3f8f4 !important; color: #347c50 !important;
    font-size: 26px !important; line-height: 1 !important; box-shadow: none !important;
  }
  html body header.header > .header-container > .header-search {
    grid-area: search !important; display: flex !important; position: static !important;
    justify-self: stretch !important; align-self: stretch !important; width: 100% !important;
    min-width: 0 !important; max-width: none !important; height: 42px !important;
    margin: 0 !important; padding: 0 5px 0 12px !important; box-sizing: border-box !important;
    border: 1px solid #e0e9e1 !important; border-radius: 24px !important; background: #f7faf7 !important;
  }
  html body header.header > .header-container > .header-search input { width: 100% !important; min-width: 0 !important; height: 40px !important; margin: 0 !important; font-size: 13px !important; }
  html body header.header > .header-container > .header-search button { flex: 0 0 32px !important; width: 32px !important; min-width: 32px !important; height: 32px !important; margin: 0 !important; }
  html body header.header > .header-container > .navbar,
  html body header.header > .header-container > .nav,
  html body header.header > .header-container > #user-header { display: none !important; }
  html body header.header > .header-container.mobile-menu-open > .navbar,
  html body header.header > .header-container.mobile-menu-open > .nav {
    grid-area: nav !important; display: flex !important; position: static !important;
    flex-direction: row !important; flex-wrap: wrap !important; gap: 7px !important;
    width: 100% !important; min-width: 0 !important; margin: 0 !important; padding: 10px 0 0 !important;
    border-top: 1px solid #e8efe9 !important; overflow: visible !important;
  }
  html body header.header > .header-container.mobile-menu-open > #user-header {
    grid-area: user !important; display: flex !important; position: static !important;
    flex-direction: row !important; flex-wrap: wrap !important; align-items: center !important;
    gap: 7px !important; width: 100% !important; max-width: none !important; min-width: 0 !important;
    margin: 0 !important; padding: 10px 0 0 !important; border-top: 1px solid #e8efe9 !important;
  }
  html body header.header > .header-container.mobile-menu-open > .navbar a,
  html body header.header > .header-container.mobile-menu-open > .nav a,
  html body header.header > .header-container.mobile-menu-open > #user-header a,
  html body header.header > .header-container.mobile-menu-open > #user-header button {
    min-height: 34px !important; max-width: 100% !important; box-sizing: border-box !important;
    border-radius: 9px !important; font-size: 12px !important;
  }
}


/* HÀO DRINK — mobile off-canvas menu modeled on the supplied reference */
@media (max-width: 700px) {
  body header.header { position:relative !important; z-index:100 !important; }
  body header.header > .header-container {
    display:grid !important; grid-template-columns:minmax(0,1fr) 42px 42px !important;
    grid-template-areas:"logo cart toggle" "search search search" !important;
    grid-template-rows:44px 42px !important; align-items:center !important; justify-items:stretch !important;
    gap:10px 8px !important; width:100% !important; max-width:100% !important; min-height:0 !important;
    height:auto !important; margin:0 !important; padding:10px 14px 12px !important; box-sizing:border-box !important;
    overflow:visible !important;
  }
  body header.header > .header-container > .logo {grid-area:logo !important;display:flex !important;align-items:center !important;justify-self:start !important;width:max-content !important;max-width:100% !important;min-width:0 !important;height:40px !important;margin:0 !important;padding:0 !important;white-space:nowrap !important;}
  body header.header > .header-container > .logo .logo-leaf {width:25px !important;height:30px !important;object-fit:contain !important;}
  body header.header > .header-container > .logo span {font-size:16px !important;line-height:1 !important;}
  body header.header > .header-container > .cart {grid-area:cart !important;position:relative !important;justify-self:center !important;display:inline-flex !important;align-items:center !important;justify-content:center !important;width:40px !important;min-width:40px !important;height:40px !important;margin:0 !important;padding:0 !important;border-radius:50% !important;}
  body header.header > .header-container > .cart span {display:none !important;}
  body header.header > .header-container > .mobile-menu-toggle {grid-area:toggle !important;position:static !important;display:inline-flex !important;align-items:center !important;justify-content:center !important;justify-self:end !important;width:40px !important;min-width:40px !important;height:40px !important;margin:0 !important;padding:0 !important;border:1px solid #dce9df !important;border-radius:12px !important;background:#f2f8f3 !important;color:#347c50 !important;font-size:27px !important;line-height:1 !important;box-shadow:none !important;}
  body header.header > .header-container > .header-search {grid-area:search !important;display:flex !important;position:static !important;width:100% !important;max-width:none !important;min-width:0 !important;height:42px !important;margin:0 !important;padding:0 5px 0 13px !important;border:1px solid #e0e9e1 !important;border-radius:24px !important;background:#f7faf7 !important;box-sizing:border-box !important;}
  body header.header > .header-container > .header-search input {width:100% !important;min-width:0 !important;height:40px !important;margin:0 !important;font-size:13px !important;}
  body header.header > .header-container > .header-search button {flex:0 0 32px !important;width:32px !important;min-width:32px !important;height:32px !important;margin:0 !important;}
  body header.header > .header-container > .navbar, body header.header > .header-container > .nav, body header.header > .header-container > #user-header {display:none !important;}
  body .hao-mobile-menu-backdrop {display:block;position:fixed;inset:0;z-index:9998;width:100%;height:100%;padding:0;border:0;background:rgba(19,36,25,.38);opacity:0;visibility:hidden;transition:opacity .22s ease,visibility .22s ease;}
  body .hao-mobile-drawer {position:fixed;z-index:9999;top:0;right:0;bottom:0;width:min(88vw,380px);height:100dvh;overflow-y:auto;overscroll-behavior:contain;background:#fff;box-shadow:-12px 0 40px rgba(14,48,27,.16);padding:18px 18px 30px;box-sizing:border-box;transform:translateX(105%);visibility:hidden;transition:transform .25s ease,visibility .25s ease;color:#263b2c;}
  body.hao-menu-is-open .hao-mobile-menu-backdrop {opacity:1;visibility:visible;}
  body.hao-menu-is-open .hao-mobile-drawer {transform:translateX(0);visibility:visible;}
  body .hao-drawer-head {display:flex;align-items:center;justify-content:space-between;gap:12px;padding:2px 0 16px;border-bottom:1px solid #e7eee8;}
  body .hao-drawer-head strong {font-size:18px;font-weight:750;color:#285f3c;}
  body .hao-drawer-close {display:flex;align-items:center;justify-content:center;width:38px;height:38px;border:0;border-radius:50%;background:#f0f6f1;color:#315e40;font-size:28px;line-height:1;cursor:pointer;}
  body .hao-drawer-search {display:flex;align-items:center;gap:8px;margin:16px 0 12px;padding:4px 5px 4px 13px;border:1px solid #e3e9e4;border-radius:24px;background:#f7f9f7;}
  body .hao-drawer-search input {flex:1;width:0;min-width:0;height:36px;border:0;outline:0;background:transparent;color:#263b2c;font-size:14px;}
  body .hao-drawer-search button {width:34px;height:34px;border:0;border-radius:50%;background:#347c50;color:#fff;font-size:23px;line-height:1;cursor:pointer;}
  body .hao-drawer-links {display:flex;flex-direction:column;gap:0;}
  body .hao-drawer-links a, body .hao-drawer-account a, body .hao-drawer-account button {display:flex;align-items:center;justify-content:space-between;gap:10px;width:100%;min-height:49px;padding:13px 3px;border:0;border-bottom:1px solid #edf1ed;border-radius:0;background:#fff;color:#46534a;text-align:left;text-decoration:none;font-size:14px;font-weight:600;box-sizing:border-box;cursor:pointer;}
  body .hao-drawer-links a.active {color:#347c50;}
  body .hao-drawer-account {display:flex;flex-direction:column;margin-top:8px;}
  body .hao-drawer-account a, body .hao-drawer-account button {color:#347c50;}
}
@media (min-width:701px) { .hao-mobile-menu-backdrop,.hao-mobile-drawer {display:none !important;} .mobile-menu-toggle {display:none !important;} }
@media (prefers-reduced-motion: reduce) { body .hao-mobile-drawer,body .hao-mobile-menu-backdrop {transition:none !important;} }

/* Mobile: keep admin shortcuts inside the hamburger drawer, not below the header. */
@media (max-width: 700px) {
  body #admin-home-panel { display: none !important; }
  body .hao-drawer-admin-logout { color: #b33b3b !important; }
}

/* FIX THEO YEU CAU: mobile bo nhan ADMIN MODE va thanh tim kiem tren header. */
@media (max-width: 700px) {
  html body header.header > .header-container {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) 40px 40px !important;
    grid-template-areas: "logo cart toggle" !important;
    align-items: center !important;
    column-gap: 8px !important;
    row-gap: 0 !important;
    width: calc(100% - 28px) !important;
    max-width: none !important;
    min-height: 66px !important;
    height: auto !important;
    padding: 10px 0 !important;
  }
  html body header.header > .header-container > .logo {
    grid-area: logo !important; justify-self: start !important; min-width: 0 !important;
    margin: 0 !important; padding: 0 !important;
  }
  html body header.header > .header-container > .cart {
    grid-area: cart !important; justify-self: center !important;
    width: 38px !important; min-width: 38px !important; height: 38px !important;
    margin: 0 !important; padding: 0 !important;
  }
  html body header.header > .header-container > .cart span { display: none !important; }
  html body header.header > .header-container > .mobile-menu-toggle {
    grid-area: toggle !important; justify-self: end !important;
    display: inline-flex !important; position: static !important;
    width: 38px !important; min-width: 38px !important; height: 38px !important;
    margin: 0 !important; padding: 0 !important;
  }
  html body header.header > .header-container > .header-search,
  html body header.header > .header-container > .navbar,
  html body header.header > .header-container > .nav,
  html body header.header > .header-container > #user-header {
    display: none !important;
  }
  html body header.header > .header-container::after { display: none !important; content: none !important; }
  html body header.header > .header-container > .logo::before { display: none !important; }
  html body header.header { padding-bottom: 0 !important; margin-bottom: 0 !important; }
}


/* FINAL MOBILE HEADER LAYOUT: logo + cart + hamburger on ONE row */
@media (max-width: 700px) {
  html body header.header {
    display: block !important;
    width: 100% !important;
    height: auto !important;
    min-height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: visible !important;
  }
  html body header.header > .header-container {
    display: flex !important;
    flex-flow: row nowrap !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 8px !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    height: 64px !important;
    min-height: 64px !important;
    margin: 0 !important;
    padding: 8px 12px !important;
    box-sizing: border-box !important;
    overflow: hidden !important;
  }
  html body header.header > .header-container > .logo {
    display: inline-flex !important;
    flex: 1 1 auto !important;
    min-width: 0 !important;
    max-width: calc(100% - 100px) !important;
    align-items: center !important;
    justify-content: flex-start !important;
    margin: 0 !important;
    padding: 0 !important;
    white-space: nowrap !important;
  }
  html body header.header > .header-container > .logo img {
    max-width: 24px !important;
    max-height: 30px !important;
    object-fit: contain !important;
  }
  html body header.header > .header-container > .cart {
    display: inline-flex !important;
    position: relative !important;
    flex: 0 0 38px !important;
    align-items: center !important;
    justify-content: center !important;
    width: 38px !important;
    min-width: 38px !important;
    max-width: 38px !important;
    height: 38px !important;
    min-height: 38px !important;
    margin: 0 !important;
    padding: 0 !important;
    order: 2 !important;
  }
  html body header.header > .header-container > .cart span { display: none !important; }
  html body header.header > .header-container > .cart b {
    position: absolute !important;
    top: -4px !important;
    right: -3px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    min-width: 16px !important;
    height: 16px !important;
    padding: 0 3px !important;
    border-radius: 99px !important;
    font-size: 10px !important;
  }
  html body header.header > .header-container > .mobile-menu-toggle {
    display: inline-flex !important;
    position: static !important;
    flex: 0 0 38px !important;
    order: 3 !important;
    align-items: center !important;
    justify-content: center !important;
    width: 38px !important;
    min-width: 38px !important;
    max-width: 38px !important;
    height: 38px !important;
    min-height: 38px !important;
    margin: 0 !important;
    padding: 0 !important;
    transform: none !important;
    float: none !important;
  }
  html body header.header > .header-container > .navbar,
  html body header.header > .header-container > .nav,
  html body header.header > .header-container > .header-search,
  html body header.header > .header-container > #header-search,
  html body header.header > .header-container > #user-header,
  html body header.header > .header-container > .user-header,
  html body header.header > .header-container .admin-mode,
  html body header.header > .header-container .admin-mode-badge,
  html body header.header > .header-container .user-header-admin,
  html body header.header > .header-container [class*="admin-mode"] {
    display: none !important;
  }
  html body header.header > .header-container::before,
  html body header.header > .header-container::after {
    content: none !important;
    display: none !important;
  }
  html body #admin-home-panel { display: none !important; }
}


/* FINAL FIX: mobile header keeps logo, account, cart and hamburger on one row */
@media (max-width: 700px) {
  html body header.header > .header-container {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) 36px 38px 38px !important;
    grid-template-rows: 42px !important;
    grid-template-areas: "logo user cart toggle" !important;
    align-items: center !important;
    column-gap: 7px !important;
    row-gap: 0 !important;
    min-height: 62px !important;
    height: auto !important;
    padding: 9px 12px !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }
  html body header.header > .header-container > .logo { grid-area: logo !important; min-width: 0 !important; }
  html body header.header > .header-container > #user-header {
    grid-area: user !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 36px !important;
    min-width: 36px !important;
    max-width: 36px !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: visible !important;
  }
  html body header.header #user-header .user-header-guest { display:flex !important; align-items:center !important; justify-content:center !important; margin:0 !important; padding:0 !important; }
  html body header.header #user-header .user-header-link {
    display:inline-flex !important; align-items:center !important; justify-content:center !important;
    width:34px !important; min-width:34px !important; height:34px !important; min-height:34px !important;
    padding:0 !important; border:1px solid #dce9df !important; border-radius:50% !important;
    background:#fff !important; color:#347c50 !important; text-decoration:none !important; line-height:1 !important;
  }
  html body header.header #user-header .user-header-icon { display:inline-flex !important; align-items:center !important; justify-content:center !important; font-size:16px !important; width:18px !important; height:18px !important; }
  html body header.header #user-header .user-header-text { display:none !important; }
  html body header.header > .header-container > .cart { grid-area:cart !important; justify-self:center !important; width:36px !important; min-width:36px !important; height:36px !important; }
  html body header.header > .header-container > .mobile-menu-toggle { grid-area:toggle !important; justify-self:end !important; width:36px !important; min-width:36px !important; height:36px !important; }
  html body header.header > .header-container > .header-search,
  html body header.header > .header-container > .navbar,
  html body header.header > .header-container > .nav { display:none !important; }
}
